﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Helpers;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.CampaignSystem.ComponentInterfaces;
using TaleWorlds.CampaignSystem.GameState;
using TaleWorlds.CampaignSystem.Map;
using TaleWorlds.CampaignSystem.MapEvents;
using TaleWorlds.CampaignSystem.Party.PartyComponents;
using TaleWorlds.CampaignSystem.Roster;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.CampaignSystem.Siege;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;
using TaleWorlds.SaveSystem.Load;

namespace TaleWorlds.CampaignSystem.Party
{
	// Token: 0x02000299 RID: 665
	public sealed class MobileParty : CampaignObjectBase, ILocatable<MobileParty>, IMapPoint, ITrackableCampaignObject, ITrackableBase, IMapEntity, IRandomOwner
	{
		// Token: 0x06002473 RID: 9331 RVA: 0x0009AFD8 File Offset: 0x000991D8
		internal static void AutoGeneratedStaticCollectObjectsMobileParty(object o, List<object> collectedObjects)
		{
			((MobileParty)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
		}

		// Token: 0x06002474 RID: 9332 RVA: 0x0009AFE8 File Offset: 0x000991E8
		protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
		{
			base.AutoGeneratedInstanceCollectObjects(collectedObjects);
			collectedObjects.Add(this._currentSettlement);
			collectedObjects.Add(this._attachedTo);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this._disorganizedUntilTime, collectedObjects);
			collectedObjects.Add(this._besiegerCamp);
			collectedObjects.Add(this._targetParty);
			collectedObjects.Add(this._targetSettlement);
			collectedObjects.Add(this._customHomeSettlement);
			collectedObjects.Add(this._army);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this._ignoredUntilTime, collectedObjects);
			collectedObjects.Add(this._actualClan);
			collectedObjects.Add(this._partyComponent);
			collectedObjects.Add(this.CustomName);
			collectedObjects.Add(this.LastVisitedSettlement);
			collectedObjects.Add(this.Ai);
			collectedObjects.Add(this.Party);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this.StationaryStartTime, collectedObjects);
			collectedObjects.Add(this.Scout);
			collectedObjects.Add(this.Engineer);
			collectedObjects.Add(this.Quartermaster);
			collectedObjects.Add(this.Surgeon);
		}

		// Token: 0x06002475 RID: 9333 RVA: 0x0009B0FB File Offset: 0x000992FB
		internal static object AutoGeneratedGetMemberValueCustomName(object o)
		{
			return ((MobileParty)o).CustomName;
		}

		// Token: 0x06002476 RID: 9334 RVA: 0x0009B108 File Offset: 0x00099308
		internal static object AutoGeneratedGetMemberValueLastVisitedSettlement(object o)
		{
			return ((MobileParty)o).LastVisitedSettlement;
		}

		// Token: 0x06002477 RID: 9335 RVA: 0x0009B115 File Offset: 0x00099315
		internal static object AutoGeneratedGetMemberValueBearing(object o)
		{
			return ((MobileParty)o).Bearing;
		}

		// Token: 0x06002478 RID: 9336 RVA: 0x0009B127 File Offset: 0x00099327
		internal static object AutoGeneratedGetMemberValueAggressiveness(object o)
		{
			return ((MobileParty)o).Aggressiveness;
		}

		// Token: 0x06002479 RID: 9337 RVA: 0x0009B139 File Offset: 0x00099339
		internal static object AutoGeneratedGetMemberValueArmyPositionAdder(object o)
		{
			return ((MobileParty)o).ArmyPositionAdder;
		}

		// Token: 0x0600247A RID: 9338 RVA: 0x0009B14B File Offset: 0x0009934B
		internal static object AutoGeneratedGetMemberValueObjective(object o)
		{
			return ((MobileParty)o).Objective;
		}

		// Token: 0x0600247B RID: 9339 RVA: 0x0009B15D File Offset: 0x0009935D
		internal static object AutoGeneratedGetMemberValueAi(object o)
		{
			return ((MobileParty)o).Ai;
		}

		// Token: 0x0600247C RID: 9340 RVA: 0x0009B16A File Offset: 0x0009936A
		internal static object AutoGeneratedGetMemberValueParty(object o)
		{
			return ((MobileParty)o).Party;
		}

		// Token: 0x0600247D RID: 9341 RVA: 0x0009B177 File Offset: 0x00099377
		internal static object AutoGeneratedGetMemberValueIsActive(object o)
		{
			return ((MobileParty)o).IsActive;
		}

		// Token: 0x0600247E RID: 9342 RVA: 0x0009B189 File Offset: 0x00099389
		internal static object AutoGeneratedGetMemberValueShortTermBehavior(object o)
		{
			return ((MobileParty)o).ShortTermBehavior;
		}

		// Token: 0x0600247F RID: 9343 RVA: 0x0009B19B File Offset: 0x0009939B
		internal static object AutoGeneratedGetMemberValueIsPartyTradeActive(object o)
		{
			return ((MobileParty)o).IsPartyTradeActive;
		}

		// Token: 0x06002480 RID: 9344 RVA: 0x0009B1AD File Offset: 0x000993AD
		internal static object AutoGeneratedGetMemberValuePartyTradeTaxGold(object o)
		{
			return ((MobileParty)o).PartyTradeTaxGold;
		}

		// Token: 0x06002481 RID: 9345 RVA: 0x0009B1BF File Offset: 0x000993BF
		internal static object AutoGeneratedGetMemberValueStationaryStartTime(object o)
		{
			return ((MobileParty)o).StationaryStartTime;
		}

		// Token: 0x06002482 RID: 9346 RVA: 0x0009B1D1 File Offset: 0x000993D1
		internal static object AutoGeneratedGetMemberValueShouldJoinPlayerBattles(object o)
		{
			return ((MobileParty)o).ShouldJoinPlayerBattles;
		}

		// Token: 0x06002483 RID: 9347 RVA: 0x0009B1E3 File Offset: 0x000993E3
		internal static object AutoGeneratedGetMemberValueIsDisbanding(object o)
		{
			return ((MobileParty)o).IsDisbanding;
		}

		// Token: 0x06002484 RID: 9348 RVA: 0x0009B1F5 File Offset: 0x000993F5
		internal static object AutoGeneratedGetMemberValueScout(object o)
		{
			return ((MobileParty)o).Scout;
		}

		// Token: 0x06002485 RID: 9349 RVA: 0x0009B202 File Offset: 0x00099402
		internal static object AutoGeneratedGetMemberValueEngineer(object o)
		{
			return ((MobileParty)o).Engineer;
		}

		// Token: 0x06002486 RID: 9350 RVA: 0x0009B20F File Offset: 0x0009940F
		internal static object AutoGeneratedGetMemberValueQuartermaster(object o)
		{
			return ((MobileParty)o).Quartermaster;
		}

		// Token: 0x06002487 RID: 9351 RVA: 0x0009B21C File Offset: 0x0009941C
		internal static object AutoGeneratedGetMemberValueSurgeon(object o)
		{
			return ((MobileParty)o).Surgeon;
		}

		// Token: 0x06002488 RID: 9352 RVA: 0x0009B229 File Offset: 0x00099429
		internal static object AutoGeneratedGetMemberValueHasUnpaidWages(object o)
		{
			return ((MobileParty)o).HasUnpaidWages;
		}

		// Token: 0x06002489 RID: 9353 RVA: 0x0009B23B File Offset: 0x0009943B
		internal static object AutoGeneratedGetMemberValueAverageFleeTargetDirection(object o)
		{
			return ((MobileParty)o).AverageFleeTargetDirection;
		}

		// Token: 0x0600248A RID: 9354 RVA: 0x0009B24D File Offset: 0x0009944D
		internal static object AutoGeneratedGetMemberValue_currentSettlement(object o)
		{
			return ((MobileParty)o)._currentSettlement;
		}

		// Token: 0x0600248B RID: 9355 RVA: 0x0009B25A File Offset: 0x0009945A
		internal static object AutoGeneratedGetMemberValue_attachedTo(object o)
		{
			return ((MobileParty)o)._attachedTo;
		}

		// Token: 0x0600248C RID: 9356 RVA: 0x0009B267 File Offset: 0x00099467
		internal static object AutoGeneratedGetMemberValue_eventPositionAdder(object o)
		{
			return ((MobileParty)o)._eventPositionAdder;
		}

		// Token: 0x0600248D RID: 9357 RVA: 0x0009B279 File Offset: 0x00099479
		internal static object AutoGeneratedGetMemberValue_position2D(object o)
		{
			return ((MobileParty)o)._position2D;
		}

		// Token: 0x0600248E RID: 9358 RVA: 0x0009B28B File Offset: 0x0009948B
		internal static object AutoGeneratedGetMemberValue_isVisible(object o)
		{
			return ((MobileParty)o)._isVisible;
		}

		// Token: 0x0600248F RID: 9359 RVA: 0x0009B29D File Offset: 0x0009949D
		internal static object AutoGeneratedGetMemberValue_isInspected(object o)
		{
			return ((MobileParty)o)._isInspected;
		}

		// Token: 0x06002490 RID: 9360 RVA: 0x0009B2AF File Offset: 0x000994AF
		internal static object AutoGeneratedGetMemberValue_disorganizedUntilTime(object o)
		{
			return ((MobileParty)o)._disorganizedUntilTime;
		}

		// Token: 0x06002491 RID: 9361 RVA: 0x0009B2C1 File Offset: 0x000994C1
		internal static object AutoGeneratedGetMemberValue_besiegerCamp(object o)
		{
			return ((MobileParty)o)._besiegerCamp;
		}

		// Token: 0x06002492 RID: 9362 RVA: 0x0009B2CE File Offset: 0x000994CE
		internal static object AutoGeneratedGetMemberValue_targetParty(object o)
		{
			return ((MobileParty)o)._targetParty;
		}

		// Token: 0x06002493 RID: 9363 RVA: 0x0009B2DB File Offset: 0x000994DB
		internal static object AutoGeneratedGetMemberValue_targetSettlement(object o)
		{
			return ((MobileParty)o)._targetSettlement;
		}

		// Token: 0x06002494 RID: 9364 RVA: 0x0009B2E8 File Offset: 0x000994E8
		internal static object AutoGeneratedGetMemberValue_targetPosition(object o)
		{
			return ((MobileParty)o)._targetPosition;
		}

		// Token: 0x06002495 RID: 9365 RVA: 0x0009B2FA File Offset: 0x000994FA
		internal static object AutoGeneratedGetMemberValue_customHomeSettlement(object o)
		{
			return ((MobileParty)o)._customHomeSettlement;
		}

		// Token: 0x06002496 RID: 9366 RVA: 0x0009B307 File Offset: 0x00099507
		internal static object AutoGeneratedGetMemberValue_army(object o)
		{
			return ((MobileParty)o)._army;
		}

		// Token: 0x06002497 RID: 9367 RVA: 0x0009B314 File Offset: 0x00099514
		internal static object AutoGeneratedGetMemberValue_isCurrentlyUsedByAQuest(object o)
		{
			return ((MobileParty)o)._isCurrentlyUsedByAQuest;
		}

		// Token: 0x06002498 RID: 9368 RVA: 0x0009B326 File Offset: 0x00099526
		internal static object AutoGeneratedGetMemberValue_partyTradeGold(object o)
		{
			return ((MobileParty)o)._partyTradeGold;
		}

		// Token: 0x06002499 RID: 9369 RVA: 0x0009B338 File Offset: 0x00099538
		internal static object AutoGeneratedGetMemberValue_ignoredUntilTime(object o)
		{
			return ((MobileParty)o)._ignoredUntilTime;
		}

		// Token: 0x0600249A RID: 9370 RVA: 0x0009B34A File Offset: 0x0009954A
		internal static object AutoGeneratedGetMemberValue_actualClan(object o)
		{
			return ((MobileParty)o)._actualClan;
		}

		// Token: 0x0600249B RID: 9371 RVA: 0x0009B357 File Offset: 0x00099557
		internal static object AutoGeneratedGetMemberValue_moraleDueToEvents(object o)
		{
			return ((MobileParty)o)._moraleDueToEvents;
		}

		// Token: 0x0600249C RID: 9372 RVA: 0x0009B369 File Offset: 0x00099569
		internal static object AutoGeneratedGetMemberValue_partyComponent(object o)
		{
			return ((MobileParty)o)._partyComponent;
		}

		// Token: 0x17000905 RID: 2309
		// (get) Token: 0x0600249D RID: 9373 RVA: 0x0009B376 File Offset: 0x00099576
		public static MobileParty MainParty
		{
			get
			{
				return Campaign.Current.MainParty;
			}
		}

		// Token: 0x17000906 RID: 2310
		// (get) Token: 0x0600249E RID: 9374 RVA: 0x0009B382 File Offset: 0x00099582
		public static MBReadOnlyList<MobileParty> All
		{
			get
			{
				return Campaign.Current.MobileParties;
			}
		}

		// Token: 0x17000907 RID: 2311
		// (get) Token: 0x0600249F RID: 9375 RVA: 0x0009B38E File Offset: 0x0009958E
		public static MBReadOnlyList<MobileParty> AllCaravanParties
		{
			get
			{
				return Campaign.Current.CaravanParties;
			}
		}

		// Token: 0x17000908 RID: 2312
		// (get) Token: 0x060024A0 RID: 9376 RVA: 0x0009B39A File Offset: 0x0009959A
		public static MBReadOnlyList<MobileParty> AllBanditParties
		{
			get
			{
				return Campaign.Current.BanditParties;
			}
		}

		// Token: 0x17000909 RID: 2313
		// (get) Token: 0x060024A1 RID: 9377 RVA: 0x0009B3A6 File Offset: 0x000995A6
		public static MBReadOnlyList<MobileParty> AllLordParties
		{
			get
			{
				return Campaign.Current.LordParties;
			}
		}

		// Token: 0x1700090A RID: 2314
		// (get) Token: 0x060024A2 RID: 9378 RVA: 0x0009B3B2 File Offset: 0x000995B2
		public static MBReadOnlyList<MobileParty> AllGarrisonParties
		{
			get
			{
				return Campaign.Current.GarrisonParties;
			}
		}

		// Token: 0x1700090B RID: 2315
		// (get) Token: 0x060024A3 RID: 9379 RVA: 0x0009B3BE File Offset: 0x000995BE
		public static MBReadOnlyList<MobileParty> AllMilitiaParties
		{
			get
			{
				return Campaign.Current.MilitiaParties;
			}
		}

		// Token: 0x1700090C RID: 2316
		// (get) Token: 0x060024A4 RID: 9380 RVA: 0x0009B3CA File Offset: 0x000995CA
		public static MBReadOnlyList<MobileParty> AllVillagerParties
		{
			get
			{
				return Campaign.Current.VillagerParties;
			}
		}

		// Token: 0x1700090D RID: 2317
		// (get) Token: 0x060024A5 RID: 9381 RVA: 0x0009B3D6 File Offset: 0x000995D6
		public static MBReadOnlyList<MobileParty> AllCustomParties
		{
			get
			{
				return Campaign.Current.CustomParties;
			}
		}

		// Token: 0x1700090E RID: 2318
		// (get) Token: 0x060024A6 RID: 9382 RVA: 0x0009B3E2 File Offset: 0x000995E2
		public static MBReadOnlyList<MobileParty> AllPartiesWithoutPartyComponent
		{
			get
			{
				return Campaign.Current.PartiesWithoutPartyComponent;
			}
		}

		// Token: 0x1700090F RID: 2319
		// (get) Token: 0x060024A7 RID: 9383 RVA: 0x0009B3EE File Offset: 0x000995EE
		public static int Count
		{
			get
			{
				return Campaign.Current.MobileParties.Count;
			}
		}

		// Token: 0x17000910 RID: 2320
		// (get) Token: 0x060024A8 RID: 9384 RVA: 0x0009B3FF File Offset: 0x000995FF
		public static MobileParty ConversationParty
		{
			get
			{
				return Campaign.Current.ConversationManager.ConversationParty;
			}
		}

		// Token: 0x17000911 RID: 2321
		// (get) Token: 0x060024A9 RID: 9385 RVA: 0x0009B410 File Offset: 0x00099610
		// (set) Token: 0x060024AA RID: 9386 RVA: 0x0009B418 File Offset: 0x00099618
		[SaveableProperty(1021)]
		private TextObject CustomName { get; set; }

		// Token: 0x17000912 RID: 2322
		// (get) Token: 0x060024AB RID: 9387 RVA: 0x0009B421 File Offset: 0x00099621
		public TextObject Name
		{
			get
			{
				if (!TextObject.IsNullOrEmpty(this.CustomName))
				{
					return this.CustomName;
				}
				if (this._partyComponent == null)
				{
					return new TextObject("{=!}unnamedMobileParty", null);
				}
				return this._partyComponent.Name;
			}
		}

		// Token: 0x17000913 RID: 2323
		// (get) Token: 0x060024AC RID: 9388 RVA: 0x0009B456 File Offset: 0x00099656
		// (set) Token: 0x060024AD RID: 9389 RVA: 0x0009B45E File Offset: 0x0009965E
		[SaveableProperty(1002)]
		public Settlement LastVisitedSettlement { get; private set; }

		// Token: 0x17000914 RID: 2324
		// (get) Token: 0x060024AE RID: 9390 RVA: 0x0009B467 File Offset: 0x00099667
		// (set) Token: 0x060024AF RID: 9391 RVA: 0x0009B46F File Offset: 0x0009966F
		[SaveableProperty(1004)]
		public Vec2 Bearing { get; internal set; }

		// Token: 0x17000915 RID: 2325
		// (get) Token: 0x060024B0 RID: 9392 RVA: 0x0009B478 File Offset: 0x00099678
		public MBReadOnlyList<MobileParty> AttachedParties
		{
			get
			{
				return this._attachedParties;
			}
		}

		// Token: 0x17000916 RID: 2326
		// (get) Token: 0x060024B1 RID: 9393 RVA: 0x0009B480 File Offset: 0x00099680
		// (set) Token: 0x060024B2 RID: 9394 RVA: 0x0009B488 File Offset: 0x00099688
		[SaveableProperty(1009)]
		public float Aggressiveness { get; set; }

		// Token: 0x17000917 RID: 2327
		// (get) Token: 0x060024B3 RID: 9395 RVA: 0x0009B491 File Offset: 0x00099691
		public int PaymentLimit
		{
			get
			{
				PartyComponent partyComponent = this._partyComponent;
				if (partyComponent == null)
				{
					return Campaign.Current.Models.PartyWageModel.MaxWage;
				}
				return partyComponent.WagePaymentLimit;
			}
		}

		// Token: 0x060024B4 RID: 9396 RVA: 0x0009B4B7 File Offset: 0x000996B7
		public bool HasLimitedWage()
		{
			return this.PaymentLimit != Campaign.Current.Models.PartyWageModel.MaxWage;
		}

		// Token: 0x060024B5 RID: 9397 RVA: 0x0009B4D8 File Offset: 0x000996D8
		public bool CanPayMoreWage()
		{
			return !this.HasLimitedWage() || this.PaymentLimit > this.TotalWage;
		}

		// Token: 0x060024B6 RID: 9398 RVA: 0x0009B4F2 File Offset: 0x000996F2
		public bool IsWageLimitExceeded()
		{
			return this.HasLimitedWage() && this.PaymentLimit < this.TotalWage;
		}

		// Token: 0x060024B7 RID: 9399 RVA: 0x0009B50C File Offset: 0x0009970C
		public void SetWagePaymentLimit(int newLimit)
		{
			PartyComponent partyComponent = this.PartyComponent;
			if (partyComponent == null)
			{
				return;
			}
			partyComponent.SetWagePaymentLimit(newLimit);
		}

		// Token: 0x17000918 RID: 2328
		// (get) Token: 0x060024B8 RID: 9400 RVA: 0x0009B51F File Offset: 0x0009971F
		// (set) Token: 0x060024B9 RID: 9401 RVA: 0x0009B527 File Offset: 0x00099727
		[SaveableProperty(1005)]
		public Vec2 ArmyPositionAdder { get; private set; }

		// Token: 0x17000919 RID: 2329
		// (get) Token: 0x060024BA RID: 9402 RVA: 0x0009B530 File Offset: 0x00099730
		public Vec2 AiBehaviorTarget
		{
			get
			{
				return this.Ai.BehaviorTarget;
			}
		}

		// Token: 0x1700091A RID: 2330
		// (get) Token: 0x060024BB RID: 9403 RVA: 0x0009B53D File Offset: 0x0009973D
		// (set) Token: 0x060024BC RID: 9404 RVA: 0x0009B545 File Offset: 0x00099745
		[SaveableProperty(1090)]
		public MobileParty.PartyObjective Objective { get; private set; }

		// Token: 0x1700091B RID: 2331
		// (get) Token: 0x060024BD RID: 9405 RVA: 0x0009B54E File Offset: 0x0009974E
		// (set) Token: 0x060024BE RID: 9406 RVA: 0x0009B556 File Offset: 0x00099756
		[CachedData]
		MobileParty ILocatable<MobileParty>.NextLocatable { get; set; }

		// Token: 0x1700091C RID: 2332
		// (get) Token: 0x060024BF RID: 9407 RVA: 0x0009B55F File Offset: 0x0009975F
		// (set) Token: 0x060024C0 RID: 9408 RVA: 0x0009B567 File Offset: 0x00099767
		[SaveableProperty(1019)]
		public MobilePartyAi Ai { get; private set; }

		// Token: 0x1700091D RID: 2333
		// (get) Token: 0x060024C1 RID: 9409 RVA: 0x0009B570 File Offset: 0x00099770
		// (set) Token: 0x060024C2 RID: 9410 RVA: 0x0009B578 File Offset: 0x00099778
		[SaveableProperty(1020)]
		public PartyBase Party { get; private set; }

		// Token: 0x1700091E RID: 2334
		// (get) Token: 0x060024C3 RID: 9411 RVA: 0x0009B581 File Offset: 0x00099781
		// (set) Token: 0x060024C4 RID: 9412 RVA: 0x0009B589 File Offset: 0x00099789
		[SaveableProperty(1023)]
		public bool IsActive { get; set; }

		// Token: 0x1700091F RID: 2335
		// (get) Token: 0x060024C5 RID: 9413 RVA: 0x0009B592 File Offset: 0x00099792
		public CampaignTime DisorganizedUntilTime
		{
			get
			{
				return this._disorganizedUntilTime;
			}
		}

		// Token: 0x17000920 RID: 2336
		// (get) Token: 0x060024C6 RID: 9414 RVA: 0x0009B59A File Offset: 0x0009979A
		// (set) Token: 0x060024C7 RID: 9415 RVA: 0x0009B5A2 File Offset: 0x000997A2
		[CachedData]
		public PartyThinkParams ThinkParamsCache { get; private set; }

		// Token: 0x17000921 RID: 2337
		// (get) Token: 0x060024C8 RID: 9416 RVA: 0x0009B5AB File Offset: 0x000997AB
		public float Speed
		{
			get
			{
				return this.CalculateSpeed();
			}
		}

		// Token: 0x17000922 RID: 2338
		// (get) Token: 0x060024C9 RID: 9417 RVA: 0x0009B5B4 File Offset: 0x000997B4
		public ExplainedNumber SpeedExplained
		{
			get
			{
				this._lastCalculatedBaseSpeedExplained = Campaign.Current.Models.PartySpeedCalculatingModel.CalculateBaseSpeed(this, true, 0, 0);
				ExplainedNumber result = Campaign.Current.Models.PartySpeedCalculatingModel.CalculateFinalSpeed(this, this._lastCalculatedBaseSpeedExplained);
				this._lastCalculatedSpeed = result.ResultNumber;
				return result;
			}
		}

		// Token: 0x17000923 RID: 2339
		// (get) Token: 0x060024CA RID: 9418 RVA: 0x0009B609 File Offset: 0x00099809
		public MobileParty ShortTermTargetParty
		{
			get
			{
				PartyBase aiBehaviorPartyBase = this.Ai.AiBehaviorPartyBase;
				if (aiBehaviorPartyBase == null)
				{
					return null;
				}
				return aiBehaviorPartyBase.MobileParty;
			}
		}

		// Token: 0x17000924 RID: 2340
		// (get) Token: 0x060024CB RID: 9419 RVA: 0x0009B621 File Offset: 0x00099821
		public Settlement ShortTermTargetSettlement
		{
			get
			{
				PartyBase aiBehaviorPartyBase = this.Ai.AiBehaviorPartyBase;
				if (aiBehaviorPartyBase == null)
				{
					return null;
				}
				return aiBehaviorPartyBase.Settlement;
			}
		}

		// Token: 0x17000925 RID: 2341
		// (get) Token: 0x060024CC RID: 9420 RVA: 0x0009B639 File Offset: 0x00099839
		public bool IsDisorganized
		{
			get
			{
				return this._isDisorganized;
			}
		}

		// Token: 0x17000926 RID: 2342
		// (get) Token: 0x060024CD RID: 9421 RVA: 0x0009B641 File Offset: 0x00099841
		public bool IsCurrentlyUsedByAQuest
		{
			get
			{
				return this._isCurrentlyUsedByAQuest;
			}
		}

		// Token: 0x17000927 RID: 2343
		// (get) Token: 0x060024CE RID: 9422 RVA: 0x0009B649 File Offset: 0x00099849
		// (set) Token: 0x060024CF RID: 9423 RVA: 0x0009B651 File Offset: 0x00099851
		[SaveableProperty(1050)]
		public AiBehavior ShortTermBehavior { get; internal set; }

		// Token: 0x17000928 RID: 2344
		// (get) Token: 0x060024D0 RID: 9424 RVA: 0x0009B65A File Offset: 0x0009985A
		// (set) Token: 0x060024D1 RID: 9425 RVA: 0x0009B662 File Offset: 0x00099862
		[SaveableProperty(1958)]
		public bool IsPartyTradeActive { get; private set; }

		// Token: 0x17000929 RID: 2345
		// (get) Token: 0x060024D2 RID: 9426 RVA: 0x0009B66B File Offset: 0x0009986B
		// (set) Token: 0x060024D3 RID: 9427 RVA: 0x0009B673 File Offset: 0x00099873
		public int PartyTradeGold
		{
			get
			{
				return this._partyTradeGold;
			}
			set
			{
				this._partyTradeGold = MathF.Max(value, 0);
			}
		}

		// Token: 0x1700092A RID: 2346
		// (get) Token: 0x060024D4 RID: 9428 RVA: 0x0009B682 File Offset: 0x00099882
		// (set) Token: 0x060024D5 RID: 9429 RVA: 0x0009B68A File Offset: 0x0009988A
		[SaveableProperty(1957)]
		public int PartyTradeTaxGold { get; private set; }

		// Token: 0x1700092B RID: 2347
		// (get) Token: 0x060024D6 RID: 9430 RVA: 0x0009B693 File Offset: 0x00099893
		// (set) Token: 0x060024D7 RID: 9431 RVA: 0x0009B69B File Offset: 0x0009989B
		[SaveableProperty(1960)]
		public CampaignTime StationaryStartTime { get; private set; }

		// Token: 0x1700092C RID: 2348
		// (get) Token: 0x060024D8 RID: 9432 RVA: 0x0009B6A4 File Offset: 0x000998A4
		// (set) Token: 0x060024D9 RID: 9433 RVA: 0x0009B6AC File Offset: 0x000998AC
		[CachedData]
		public int VersionNo { get; private set; }

		// Token: 0x1700092D RID: 2349
		// (get) Token: 0x060024DA RID: 9434 RVA: 0x0009B6B5 File Offset: 0x000998B5
		// (set) Token: 0x060024DB RID: 9435 RVA: 0x0009B6BD File Offset: 0x000998BD
		[SaveableProperty(1080)]
		public bool ShouldJoinPlayerBattles { get; set; }

		// Token: 0x1700092E RID: 2350
		// (get) Token: 0x060024DC RID: 9436 RVA: 0x0009B6C6 File Offset: 0x000998C6
		// (set) Token: 0x060024DD RID: 9437 RVA: 0x0009B6CE File Offset: 0x000998CE
		[SaveableProperty(1081)]
		public bool IsDisbanding { get; set; }

		// Token: 0x1700092F RID: 2351
		// (get) Token: 0x060024DE RID: 9438 RVA: 0x0009B6D7 File Offset: 0x000998D7
		public int RandomValue
		{
			get
			{
				return this.Party.RandomValue;
			}
		}

		// Token: 0x17000930 RID: 2352
		// (get) Token: 0x060024DF RID: 9439 RVA: 0x0009B6E4 File Offset: 0x000998E4
		// (set) Token: 0x060024E0 RID: 9440 RVA: 0x0009B6EC File Offset: 0x000998EC
		public Settlement CurrentSettlement
		{
			get
			{
				return this._currentSettlement;
			}
			set
			{
				if (value != this._currentSettlement)
				{
					if (this._currentSettlement != null)
					{
						this._currentSettlement.RemoveMobileParty(this);
					}
					this._currentSettlement = value;
					if (this._currentSettlement != null)
					{
						this._currentSettlement.AddMobileParty(this);
						if (this._currentSettlement.IsFortification)
						{
							this.Position2D = this._currentSettlement.GatePosition;
						}
						this.LastVisitedSettlement = value;
					}
					foreach (MobileParty mobileParty in this._attachedParties)
					{
						mobileParty.CurrentSettlement = value;
					}
					if (this._currentSettlement != null && this._currentSettlement.IsFortification)
					{
						this.ArmyPositionAdder = Vec2.Zero;
						this.ErrorPosition = Vec2.Zero;
						this.Bearing = Vec2.Zero;
						this.Party.AverageBearingRotation = 0f;
						foreach (MobileParty mobileParty2 in this._currentSettlement.Parties)
						{
							mobileParty2.Party.SetVisualAsDirty();
						}
					}
					this.Party.SetVisualAsDirty();
				}
			}
		}

		// Token: 0x17000931 RID: 2353
		// (get) Token: 0x060024E1 RID: 9441 RVA: 0x0009B838 File Offset: 0x00099A38
		public Settlement HomeSettlement
		{
			get
			{
				Settlement result;
				if ((result = this._customHomeSettlement) == null)
				{
					PartyComponent partyComponent = this._partyComponent;
					if (partyComponent == null)
					{
						return null;
					}
					result = partyComponent.HomeSettlement;
				}
				return result;
			}
		}

		// Token: 0x060024E2 RID: 9442 RVA: 0x0009B855 File Offset: 0x00099A55
		public void SetCustomHomeSettlement(Settlement customHomeSettlement)
		{
			this._customHomeSettlement = customHomeSettlement;
		}

		// Token: 0x17000932 RID: 2354
		// (get) Token: 0x060024E3 RID: 9443 RVA: 0x0009B85E File Offset: 0x00099A5E
		// (set) Token: 0x060024E4 RID: 9444 RVA: 0x0009B866 File Offset: 0x00099A66
		public MobileParty AttachedTo
		{
			get
			{
				return this._attachedTo;
			}
			set
			{
				if (this._attachedTo != value)
				{
					this.SetAttachedToInternal(value);
				}
			}
		}

		// Token: 0x060024E5 RID: 9445 RVA: 0x0009B878 File Offset: 0x00099A78
		private void SetAttachedToInternal(MobileParty value)
		{
			if (this._attachedTo != null)
			{
				this._attachedTo.RemoveAttachedPartyInternal(this);
				if (this.Party.MapEventSide != null)
				{
					this.Party.MapEventSide.HandleMapEventEndForPartyInternal(this.Party);
					this.Party.MapEventSide = null;
				}
				if (this.BesiegerCamp != null)
				{
					this.BesiegerCamp = null;
				}
				this.OnAttachedToRemoved();
			}
			this._attachedTo = value;
			if (this._attachedTo != null)
			{
				this._attachedTo.AddAttachedPartyInternal(this);
				this.Party.MapEventSide = this._attachedTo.Party.MapEventSide;
				this.BesiegerCamp = this._attachedTo.BesiegerCamp;
				this.CurrentSettlement = this._attachedTo.CurrentSettlement;
			}
			this.Party.SetVisualAsDirty();
		}

		// Token: 0x060024E6 RID: 9446 RVA: 0x0009B940 File Offset: 0x00099B40
		private void AddAttachedPartyInternal(MobileParty mobileParty)
		{
			if (this._attachedParties == null)
			{
				this._attachedParties = new MBList<MobileParty>();
			}
			this._attachedParties.Add(mobileParty);
			if (CampaignEventDispatcher.Instance != null)
			{
				CampaignEventDispatcher.Instance.OnPartyAttachedAnotherParty(mobileParty);
			}
		}

		// Token: 0x060024E7 RID: 9447 RVA: 0x0009B973 File Offset: 0x00099B73
		private void RemoveAttachedPartyInternal(MobileParty mobileParty)
		{
			this._attachedParties.Remove(mobileParty);
		}

		// Token: 0x060024E8 RID: 9448 RVA: 0x0009B984 File Offset: 0x00099B84
		private void OnAttachedToRemoved()
		{
			this.ErrorPosition += this.ArmyPositionAdder;
			this.ArmyPositionAdder = Vec2.Zero;
			if (!this.IsVisible)
			{
				this.ErrorPosition = Vec2.Zero;
			}
			if (this.CurrentSettlement != null)
			{
				this.Ai.SetMoveGoToSettlement(this.CurrentSettlement);
				return;
			}
			this.Ai.SetMoveModeHold();
		}

		// Token: 0x17000933 RID: 2355
		// (get) Token: 0x060024E9 RID: 9449 RVA: 0x0009B9EB File Offset: 0x00099BEB
		// (set) Token: 0x060024EA RID: 9450 RVA: 0x0009B9F4 File Offset: 0x00099BF4
		public Army Army
		{
			get
			{
				return this._army;
			}
			set
			{
				if (this._army != value)
				{
					this.UpdateVersionNo();
					if (this._army != null)
					{
						this._army.OnRemovePartyInternal(this);
					}
					this._army = value;
					if (value == null)
					{
						if (this == MobileParty.MainParty && Game.Current.GameStateManager.ActiveState is MapState)
						{
							((MapState)Game.Current.GameStateManager.ActiveState).OnLeaveArmy();
							return;
						}
					}
					else
					{
						this._army.OnAddPartyInternal(this);
						this.Ai.ResetNumberOfRecentFleeing();
					}
				}
			}
		}

		// Token: 0x17000934 RID: 2356
		// (get) Token: 0x060024EB RID: 9451 RVA: 0x0009BA7D File Offset: 0x00099C7D
		// (set) Token: 0x060024EC RID: 9452 RVA: 0x0009BA88 File Offset: 0x00099C88
		public BesiegerCamp BesiegerCamp
		{
			get
			{
				return this._besiegerCamp;
			}
			set
			{
				if (this._besiegerCamp != value && !this._besiegerCampResetStarted)
				{
					this._besiegerCampResetStarted = true;
					if (this._besiegerCamp != null)
					{
						this.OnPartyLeftSiegeInternal();
					}
					this._besiegerCamp = value;
					if (this._besiegerCamp != null)
					{
						this.OnPartyJoinedSiegeInternal();
					}
					foreach (MobileParty mobileParty in this._attachedParties)
					{
						mobileParty.BesiegerCamp = value;
					}
					this.Party.SetVisualAsDirty();
					this._besiegerCampResetStarted = false;
				}
			}
		}

		// Token: 0x17000935 RID: 2357
		// (get) Token: 0x060024ED RID: 9453 RVA: 0x0009BB28 File Offset: 0x00099D28
		public AiBehavior DefaultBehavior
		{
			get
			{
				return this.Ai.DefaultBehavior;
			}
		}

		// Token: 0x17000936 RID: 2358
		// (get) Token: 0x060024EE RID: 9454 RVA: 0x0009BB35 File Offset: 0x00099D35
		// (set) Token: 0x060024EF RID: 9455 RVA: 0x0009BB3D File Offset: 0x00099D3D
		public Settlement TargetSettlement
		{
			get
			{
				return this._targetSettlement;
			}
			internal set
			{
				if (value != this._targetSettlement)
				{
					this._targetSettlement = value;
					this.Ai.DefaultBehaviorNeedsUpdate = true;
				}
			}
		}

		// Token: 0x17000937 RID: 2359
		// (get) Token: 0x060024F0 RID: 9456 RVA: 0x0009BB5B File Offset: 0x00099D5B
		// (set) Token: 0x060024F1 RID: 9457 RVA: 0x0009BB63 File Offset: 0x00099D63
		public Vec2 TargetPosition
		{
			get
			{
				return this._targetPosition;
			}
			internal set
			{
				if (this._targetPosition != value)
				{
					this._targetPosition = value;
					this.Ai.DefaultBehaviorNeedsUpdate = true;
				}
			}
		}

		// Token: 0x17000938 RID: 2360
		// (get) Token: 0x060024F2 RID: 9458 RVA: 0x0009BB86 File Offset: 0x00099D86
		// (set) Token: 0x060024F3 RID: 9459 RVA: 0x0009BB8E File Offset: 0x00099D8E
		public MobileParty TargetParty
		{
			get
			{
				return this._targetParty;
			}
			internal set
			{
				if (value != this._targetParty)
				{
					this._targetParty = value;
					this.Ai.DefaultBehaviorNeedsUpdate = true;
				}
			}
		}

		// Token: 0x060024F4 RID: 9460 RVA: 0x0009BBAC File Offset: 0x00099DAC
		public MobileParty()
		{
			this._isVisible = false;
			this.IsActive = true;
			this._isCurrentlyUsedByAQuest = false;
			this.Party = new PartyBase(this);
			this.InitMembers();
			this.InitCached();
			this.Initialize();
		}

		// Token: 0x060024F5 RID: 9461 RVA: 0x0009BC24 File Offset: 0x00099E24
		private void InitMembers()
		{
			if (this._attachedParties == null)
			{
				this._attachedParties = new MBList<MobileParty>();
			}
		}

		// Token: 0x17000939 RID: 2361
		// (get) Token: 0x060024F6 RID: 9462 RVA: 0x0009BC39 File Offset: 0x00099E39
		public Hero LeaderHero
		{
			get
			{
				PartyComponent partyComponent = this.PartyComponent;
				if (partyComponent == null)
				{
					return null;
				}
				return partyComponent.Leader;
			}
		}

		// Token: 0x1700093A RID: 2362
		// (get) Token: 0x060024F7 RID: 9463 RVA: 0x0009BC4C File Offset: 0x00099E4C
		// (set) Token: 0x060024F8 RID: 9464 RVA: 0x0009BC54 File Offset: 0x00099E54
		[SaveableProperty(1070)]
		private Hero Scout { get; set; }

		// Token: 0x1700093B RID: 2363
		// (get) Token: 0x060024F9 RID: 9465 RVA: 0x0009BC5D File Offset: 0x00099E5D
		// (set) Token: 0x060024FA RID: 9466 RVA: 0x0009BC65 File Offset: 0x00099E65
		[SaveableProperty(1072)]
		private Hero Engineer { get; set; }

		// Token: 0x1700093C RID: 2364
		// (get) Token: 0x060024FB RID: 9467 RVA: 0x0009BC6E File Offset: 0x00099E6E
		// (set) Token: 0x060024FC RID: 9468 RVA: 0x0009BC76 File Offset: 0x00099E76
		[SaveableProperty(1071)]
		private Hero Quartermaster { get; set; }

		// Token: 0x1700093D RID: 2365
		// (get) Token: 0x060024FD RID: 9469 RVA: 0x0009BC7F File Offset: 0x00099E7F
		// (set) Token: 0x060024FE RID: 9470 RVA: 0x0009BC87 File Offset: 0x00099E87
		[SaveableProperty(1073)]
		private Hero Surgeon { get; set; }

		// Token: 0x1700093E RID: 2366
		// (get) Token: 0x060024FF RID: 9471 RVA: 0x0009BC90 File Offset: 0x00099E90
		public Hero Owner
		{
			get
			{
				PartyComponent partyComponent = this._partyComponent;
				if (partyComponent == null)
				{
					return null;
				}
				return partyComponent.PartyOwner;
			}
		}

		// Token: 0x1700093F RID: 2367
		// (get) Token: 0x06002500 RID: 9472 RVA: 0x0009BCA3 File Offset: 0x00099EA3
		public Hero EffectiveScout
		{
			get
			{
				if (this.Scout == null || this.Scout.PartyBelongedTo != this)
				{
					return this.LeaderHero;
				}
				return this.Scout;
			}
		}

		// Token: 0x17000940 RID: 2368
		// (get) Token: 0x06002501 RID: 9473 RVA: 0x0009BCC8 File Offset: 0x00099EC8
		public Hero EffectiveQuartermaster
		{
			get
			{
				if (this.Quartermaster == null || this.Quartermaster.PartyBelongedTo != this)
				{
					return this.LeaderHero;
				}
				return this.Quartermaster;
			}
		}

		// Token: 0x17000941 RID: 2369
		// (get) Token: 0x06002502 RID: 9474 RVA: 0x0009BCED File Offset: 0x00099EED
		public Hero EffectiveEngineer
		{
			get
			{
				if (this.Engineer == null || this.Engineer.PartyBelongedTo != this)
				{
					return this.LeaderHero;
				}
				return this.Engineer;
			}
		}

		// Token: 0x17000942 RID: 2370
		// (get) Token: 0x06002503 RID: 9475 RVA: 0x0009BD12 File Offset: 0x00099F12
		public Hero EffectiveSurgeon
		{
			get
			{
				if (this.Surgeon == null || this.Surgeon.PartyBelongedTo != this)
				{
					return this.LeaderHero;
				}
				return this.Surgeon;
			}
		}

		// Token: 0x06002504 RID: 9476 RVA: 0x0009BD37 File Offset: 0x00099F37
		public void SetPartyScout(Hero hero)
		{
			this.RemoveHeroPerkRole(hero);
			this.Scout = hero;
		}

		// Token: 0x06002505 RID: 9477 RVA: 0x0009BD47 File Offset: 0x00099F47
		public void SetPartyQuartermaster(Hero hero)
		{
			this.RemoveHeroPerkRole(hero);
			this.Quartermaster = hero;
		}

		// Token: 0x06002506 RID: 9478 RVA: 0x0009BD57 File Offset: 0x00099F57
		public void SetPartyEngineer(Hero hero)
		{
			this.RemoveHeroPerkRole(hero);
			this.Engineer = hero;
		}

		// Token: 0x06002507 RID: 9479 RVA: 0x0009BD67 File Offset: 0x00099F67
		public void SetPartySurgeon(Hero hero)
		{
			this.RemoveHeroPerkRole(hero);
			this.Surgeon = hero;
		}

		// Token: 0x06002508 RID: 9480 RVA: 0x0009BD77 File Offset: 0x00099F77
		private void InitializeMobilePartyWithPartyTemplate(PartyTemplateObject pt, Vec2 position, int troopNumberLimit)
		{
			if (troopNumberLimit != 0)
			{
				this.FillPartyStacks(pt, troopNumberLimit);
			}
			this.CreateFigure(position, 0f);
			this.Ai.SetMoveModeHold();
		}

		// Token: 0x06002509 RID: 9481 RVA: 0x0009BD9B File Offset: 0x00099F9B
		public void InitializeMobilePartyAroundPosition(TroopRoster memberRoster, TroopRoster prisonerRoster, Vec2 position, float spawnRadius, float minSpawnRadius = 0f)
		{
			position = MobilePartyHelper.FindReachablePointAroundPosition(position, spawnRadius, minSpawnRadius);
			this.InitializeMobilePartyWithRosterInternal(memberRoster, prisonerRoster, position);
		}

		// Token: 0x0600250A RID: 9482 RVA: 0x0009BDB2 File Offset: 0x00099FB2
		public override void Initialize()
		{
			base.Initialize();
			this.Aggressiveness = 1f;
			this.Ai = new MobilePartyAi(this);
			CampaignEventDispatcher.Instance.OnPartyVisibilityChanged(this.Party);
		}

		// Token: 0x0600250B RID: 9483 RVA: 0x0009BDE1 File Offset: 0x00099FE1
		public void InitializeMobilePartyAtPosition(TroopRoster memberRoster, TroopRoster prisonerRoster, Vec2 position)
		{
			this.InitializeMobilePartyWithRosterInternal(memberRoster, prisonerRoster, position);
		}

		// Token: 0x0600250C RID: 9484 RVA: 0x0009BDEC File Offset: 0x00099FEC
		public void InitializeMobilePartyAtPosition(PartyTemplateObject pt, Vec2 position, int troopNumberLimit = -1)
		{
			this.InitializeMobilePartyWithPartyTemplate(pt, position, troopNumberLimit);
		}

		// Token: 0x0600250D RID: 9485 RVA: 0x0009BDF7 File Offset: 0x00099FF7
		public void InitializeMobilePartyAroundPosition(PartyTemplateObject pt, Vec2 position, float spawnRadius, float minSpawnRadius = 0f, int troopNumberLimit = -1)
		{
			position = MobilePartyHelper.FindReachablePointAroundPosition(position, spawnRadius, minSpawnRadius);
			this.InitializeMobilePartyWithPartyTemplate(pt, position, troopNumberLimit);
		}

		// Token: 0x0600250E RID: 9486 RVA: 0x0009BE0E File Offset: 0x0009A00E
		private void InitializeMobilePartyWithRosterInternal(TroopRoster memberRoster, TroopRoster prisonerRoster, Vec2 position)
		{
			this.MemberRoster.Add(memberRoster);
			this.PrisonRoster.Add(prisonerRoster);
			this.CreateFigure(position, 0f);
			this.Ai.SetMoveModeHold();
		}

		// Token: 0x17000943 RID: 2371
		// (get) Token: 0x0600250F RID: 9487 RVA: 0x0009BE3F File Offset: 0x0009A03F
		// (set) Token: 0x06002510 RID: 9488 RVA: 0x0009BE48 File Offset: 0x0009A048
		public Clan ActualClan
		{
			get
			{
				return this._actualClan;
			}
			set
			{
				if (this._actualClan != value)
				{
					WarPartyComponent warPartyComponent;
					if (this._actualClan != null && value != null && (warPartyComponent = (this.PartyComponent as WarPartyComponent)) != null)
					{
						warPartyComponent.OnClanChange(this._actualClan, value);
					}
					this._actualClan = value;
				}
			}
		}

		// Token: 0x06002511 RID: 9489 RVA: 0x0009BE8C File Offset: 0x0009A08C
		internal void StartUp()
		{
			this.Ai.StartUp();
		}

		// Token: 0x06002512 RID: 9490 RVA: 0x0009BE9C File Offset: 0x0009A09C
		[LateLoadInitializationCallback]
		private void OnLateLoad(MetaData metaData, ObjectLoadData objectLoadData)
		{
			if (MBSaveLoad.LastLoadedGameVersion < ApplicationVersion.FromString("v1.1.0", 54620))
			{
				PartyBase partyBase = (PartyBase)objectLoadData.GetMemberValueBySaveId(1052);
				IMapEntity mapEntity = null;
				if (partyBase != null)
				{
					if (partyBase.IsSettlement)
					{
						mapEntity = partyBase.Settlement;
					}
					else if (partyBase.IsMobile)
					{
						mapEntity = partyBase.MobileParty;
					}
				}
				object memberValueBySaveId = objectLoadData.GetMemberValueBySaveId(1036);
				object memberValueBySaveId2 = objectLoadData.GetMemberValueBySaveId(1037);
				object memberValueBySaveId3 = objectLoadData.GetMemberValueBySaveId(1064);
				object memberValueBySaveId4 = objectLoadData.GetMemberValueBySaveId(1065);
				object memberValueBySaveId5 = objectLoadData.GetMemberValueBySaveId(1047);
				object memberValueBySaveId6 = objectLoadData.GetMemberValueBySaveId(1051);
				object memberValueBySaveId7 = objectLoadData.GetMemberValueBySaveId(1038);
				object memberValueBySaveId8 = objectLoadData.GetMemberValueBySaveId(1039);
				object memberValueBySaveId9 = objectLoadData.GetMemberValueBySaveId(1055);
				object memberValueBySaveId10 = objectLoadData.GetMemberValueBySaveId(1054);
				object memberValueBySaveId11 = objectLoadData.GetMemberValueBySaveId(1062);
				object memberValueBySaveId12 = objectLoadData.GetMemberValueBySaveId(1061);
				object fieldValueBySaveId = objectLoadData.GetFieldValueBySaveId(1070);
				object memberValueBySaveId13 = objectLoadData.GetMemberValueBySaveId(1022);
				object obj = mapEntity ?? objectLoadData.GetMemberValueBySaveId(1056);
				object memberValueBySaveId14 = objectLoadData.GetMemberValueBySaveId(1074);
				if (memberValueBySaveId != null)
				{
					this.Ai.InitializeForOldSaves((float)memberValueBySaveId, (float)memberValueBySaveId2, (CampaignTime)memberValueBySaveId3, (int)memberValueBySaveId4, (AiBehavior)memberValueBySaveId5, (Vec2)memberValueBySaveId6, (bool)memberValueBySaveId7, (bool)memberValueBySaveId8, (MoveModeType)memberValueBySaveId9, (MobileParty)memberValueBySaveId10, (Vec2)memberValueBySaveId11, (Vec2)memberValueBySaveId12, (Vec2)fieldValueBySaveId, (Vec2)memberValueBySaveId13, (IMapEntity)obj, ((CampaignTime?)memberValueBySaveId14) ?? CampaignTime.Never);
				}
				this.UpdatePartyComponentFlags();
				if (this.IsGarrison || this.IsLordParty)
				{
					object memberValueBySaveId15 = objectLoadData.GetMemberValueBySaveId(1010);
					if (memberValueBySaveId15 != null)
					{
						this.SetWagePaymentLimit((int)memberValueBySaveId15);
					}
				}
			}
		}

		// Token: 0x17000944 RID: 2372
		// (get) Token: 0x06002513 RID: 9491 RVA: 0x0009C09C File Offset: 0x0009A29C
		// (set) Token: 0x06002514 RID: 9492 RVA: 0x0009C0A4 File Offset: 0x0009A2A4
		public float RecentEventsMorale
		{
			get
			{
				return this._moraleDueToEvents;
			}
			set
			{
				this._moraleDueToEvents = value;
				if (this._moraleDueToEvents < -50f)
				{
					this._moraleDueToEvents = -50f;
					return;
				}
				if (this._moraleDueToEvents > 50f)
				{
					this._moraleDueToEvents = 50f;
				}
			}
		}

		// Token: 0x06002515 RID: 9493 RVA: 0x0009C0DE File Offset: 0x0009A2DE
		public override string ToString()
		{
			return base.StringId + ":" + this.Party.Index;
		}

		// Token: 0x17000945 RID: 2373
		// (get) Token: 0x06002516 RID: 9494 RVA: 0x0009C100 File Offset: 0x0009A300
		public float Morale
		{
			get
			{
				float resultNumber = Campaign.Current.Models.PartyMoraleModel.GetEffectivePartyMorale(this, false).ResultNumber;
				return (resultNumber < 0f) ? 0f : ((resultNumber > 100f) ? 100f : resultNumber);
			}
		}

		// Token: 0x06002517 RID: 9495 RVA: 0x0009C14D File Offset: 0x0009A34D
		TextObject ITrackableBase.GetName()
		{
			return this.Name;
		}

		// Token: 0x17000946 RID: 2374
		// (get) Token: 0x06002518 RID: 9496 RVA: 0x0009C155 File Offset: 0x0009A355
		public ExplainedNumber MoraleExplained
		{
			get
			{
				return Campaign.Current.Models.PartyMoraleModel.GetEffectivePartyMorale(this, true);
			}
		}

		// Token: 0x06002519 RID: 9497 RVA: 0x0009C16D File Offset: 0x0009A36D
		public void ValidateSpeed()
		{
			this.CalculateSpeed();
		}

		// Token: 0x0600251A RID: 9498 RVA: 0x0009C178 File Offset: 0x0009A378
		public void ChangePartyLeader(Hero newLeader)
		{
			if (newLeader == null || !this.MemberRoster.Contains(newLeader.CharacterObject))
			{
				Debug.FailedAssert(string.Concat(new object[]
				{
					(newLeader != null) ? newLeader.Name : null,
					" is not a member of ",
					this.Name,
					"!\nParty leader did not change."
				}), "C:\\Develop\\MB3\\Source\\Bannerlord\\TaleWorlds.CampaignSystem\\Party\\MobileParty.cs", "ChangePartyLeader", 851);
				return;
			}
			if (this.IsLordParty)
			{
				LordPartyComponent lordPartyComponent = this._partyComponent as LordPartyComponent;
				if (lordPartyComponent != null)
				{
					lordPartyComponent.ChangePartyOwner(newLeader);
				}
			}
			this.PartyComponent.ChangePartyLeader(newLeader);
		}

		// Token: 0x0600251B RID: 9499 RVA: 0x0009C20E File Offset: 0x0009A40E
		public void RemovePartyLeader()
		{
			if (this.LeaderHero == null)
			{
				return;
			}
			if (this.MapEvent == null)
			{
				this.Ai.SetMoveModeHold();
			}
			this.PartyComponent.ChangePartyLeader(null);
		}

		// Token: 0x0600251C RID: 9500 RVA: 0x0009C238 File Offset: 0x0009A438
		private void RecoverPositionsForNavMeshUpdate()
		{
			if (this.Position2D.IsNonZero() && !PartyBase.IsPositionOkForTraveling(this.Position2D))
			{
				Debug.Print(string.Concat(new object[]
				{
					"Position of ",
					base.StringId,
					" is not valid! (",
					this.Position2D.x,
					", ",
					this.Position2D.y,
					") Party will be moved to a valid position."
				}), 0, Debug.DebugColor.White, 17592186044416UL);
				Settlement currentSettlement = this.CurrentSettlement;
				this.Position2D = ((currentSettlement != null) ? currentSettlement.GatePosition : SettlementHelper.FindNearestVillage(null, this).GatePosition);
			}
			if (this.CurrentSettlement != null)
			{
				float epsilon = this.CurrentSettlement.IsFortification ? Campaign.Current.Models.EncounterModel.NeededMaximumDistanceForEncounteringTown : Campaign.Current.Models.EncounterModel.NeededMaximumDistanceForEncounteringVillage;
				if (!this.CurrentSettlement.GatePosition.NearlyEquals(this.Position2D, epsilon))
				{
					Debug.Print(string.Concat(new object[]
					{
						"Position of ",
						base.StringId,
						" is not valid! (",
						this.Position2D.x,
						", ",
						this.Position2D.y,
						") Party will be moved to a valid position."
					}), 0, Debug.DebugColor.White, 17592186044416UL);
					this.Position2D = this.CurrentSettlement.GatePosition;
				}
			}
			this.Ai.RecoverPositionsForNavMeshUpdate();
		}

		// Token: 0x0600251D RID: 9501 RVA: 0x0009C3DC File Offset: 0x0009A5DC
		public void OnGameInitialized()
		{
			this.RecoverPositionsForNavMeshUpdate();
			Campaign campaign = Campaign.Current;
			if (campaign.MapSceneWrapper != null)
			{
				this.CurrentNavigationFace = campaign.MapSceneWrapper.GetFaceIndex(this.Position2D);
			}
			this.Ai.OnGameInitialized();
			MobileParty mobileParty = Campaign.Current.CampaignObjectManager.Find<MobileParty>((MobileParty x) => x.StringId == base.StringId);
			if (this != mobileParty)
			{
				DestroyPartyAction.Apply(null, this);
			}
		}

		// Token: 0x0600251E RID: 9502 RVA: 0x0009C448 File Offset: 0x0009A648
		[LoadInitializationCallback]
		private void OnLoad(MetaData metaData, ObjectLoadData objectLoadData)
		{
			object memberValueBySaveId = objectLoadData.GetMemberValueBySaveId(1032);
			if (memberValueBySaveId != null)
			{
				this._doNotAttackMainParty = (int)memberValueBySaveId;
			}
		}

		// Token: 0x0600251F RID: 9503 RVA: 0x0009C470 File Offset: 0x0009A670
		protected override void PreAfterLoad()
		{
			this.UpdatePartyComponentFlags();
			PartyComponent partyComponent = this.PartyComponent;
			if (partyComponent != null)
			{
				partyComponent.Initialize(this);
			}
			this.Ai.PreAfterLoad();
			if (this._disorganizedUntilTime.IsFuture)
			{
				this._isDisorganized = true;
			}
			if (MBSaveLoad.IsUpdatingGameVersion && MBSaveLoad.LastLoadedGameVersion.IsOlderThan(ApplicationVersion.FromString("v1.2.11.45697", 54620)) && ((this.LeaderHero != null && this != MobileParty.MainParty && this.LeaderHero.PartyBelongedTo != this) || (this.MapEvent == null && base.StringId.Contains("troops_of_"))))
			{
				DestroyPartyAction.Apply(null, this);
			}
		}

		// Token: 0x06002520 RID: 9504 RVA: 0x0009C518 File Offset: 0x0009A718
		protected override void OnBeforeLoad()
		{
			this.Ai.OnBeforeLoad();
			this.InitMembers();
			this.InitCached();
			MobileParty attachedTo = this._attachedTo;
			if (attachedTo == null)
			{
				return;
			}
			attachedTo.AddAttachedPartyInternal(this);
		}

		// Token: 0x06002521 RID: 9505 RVA: 0x0009C542 File Offset: 0x0009A742
		private void InitCached()
		{
			MobilePartyAi ai = this.Ai;
			if (ai != null)
			{
				ai.InitCached();
			}
			((ILocatable<MobileParty>)this).LocatorNodeIndex = -1;
			this.ThinkParamsCache = new PartyThinkParams(this);
			this.ResetCached();
		}

		// Token: 0x06002522 RID: 9506 RVA: 0x0009C56E File Offset: 0x0009A76E
		private void ResetCached()
		{
			this._partySizeRatioLastCheckVersion = -1;
			this._latestUsedPaymentRatio = -1;
			this._cachedPartySizeRatio = 1f;
			this.VersionNo = 0;
			this._partyPureSpeedLastCheckVersion = -1;
			this._itemRosterVersionNo = -1;
			this.Party.InitCache();
		}

		// Token: 0x06002523 RID: 9507 RVA: 0x0009C5AC File Offset: 0x0009A7AC
		protected override void AfterLoad()
		{
			this.Party.AfterLoad();
			if (this.IsGarrison && this.MapEvent == null && this.SiegeEvent == null && this.TargetParty != null && this.CurrentSettlement != null)
			{
				this.Ai.SetMoveModeHold();
			}
			if (this.CurrentSettlement != null && !this.CurrentSettlement.Parties.Contains(this))
			{
				this.CurrentSettlement.AddMobileParty(this);
				foreach (MobileParty mobileParty in this._attachedParties)
				{
					if (this.Army.LeaderParty != this)
					{
						this.CurrentSettlement.AddMobileParty(mobileParty);
					}
				}
			}
			if (this._doNotAttackMainParty > 0)
			{
				this.Ai.DoNotAttackMainPartyUntil = CampaignTime.HoursFromNow((float)this._doNotAttackMainParty);
			}
			if (this.IsCaravan && this.Army != null)
			{
				this.Army = null;
			}
			if (MBSaveLoad.IsUpdatingGameVersion && MBSaveLoad.LastLoadedGameVersion < ApplicationVersion.FromString("v1.1.0", 54620) && (this.PaymentLimit == 2000 || (this == MobileParty.MainParty && this.PaymentLimit == 0)))
			{
				this.SetWagePaymentLimit(Campaign.Current.Models.PartyWageModel.MaxWage);
			}
			if (MBSaveLoad.IsUpdatingGameVersion && MBSaveLoad.LastLoadedGameVersion < ApplicationVersion.FromString("v1.2.0", 54620) && this.IsCaravan && this.Owner == Hero.MainHero && this.ActualClan == null)
			{
				this.ActualClan = this.Owner.Clan;
			}
			if (MBSaveLoad.IsUpdatingGameVersion && MBSaveLoad.LastLoadedGameVersion < ApplicationVersion.FromString("v1.1.4", 54620))
			{
				if (this.TargetParty != null)
				{
					IFaction mapFaction = this.TargetParty.MapFaction;
					if (mapFaction == null || !mapFaction.IsAtWarWith(this.MapFaction))
					{
						goto IL_25E;
					}
				}
				if (this.TargetSettlement != null)
				{
					IFaction mapFaction2 = this.TargetSettlement.MapFaction;
					if (mapFaction2 == null || !mapFaction2.IsAtWarWith(this.MapFaction))
					{
						goto IL_25E;
					}
				}
				if (this.ShortTermTargetParty == null)
				{
					return;
				}
				MobileParty shortTermTargetParty = this.ShortTermTargetParty;
				bool flag;
				if (shortTermTargetParty == null)
				{
					flag = true;
				}
				else
				{
					IFaction mapFaction3 = shortTermTargetParty.MapFaction;
					bool? flag2 = (mapFaction3 != null) ? new bool?(mapFaction3.IsAtWarWith(this.MapFaction)) : null;
					bool flag3 = true;
					flag = !(flag2.GetValueOrDefault() == flag3 & flag2 != null);
				}
				if (!flag)
				{
					return;
				}
				IL_25E:
				this.Ai.SetMoveModeHold();
			}
		}

		// Token: 0x06002524 RID: 9508 RVA: 0x0009C834 File Offset: 0x0009AA34
		internal void OnFinishLoadState()
		{
			Campaign.Current.MobilePartyLocator.UpdateLocator(this);
		}

		// Token: 0x17000947 RID: 2375
		// (get) Token: 0x06002525 RID: 9509 RVA: 0x0009C847 File Offset: 0x0009AA47
		// (set) Token: 0x06002526 RID: 9510 RVA: 0x0009C84F File Offset: 0x0009AA4F
		int ILocatable<MobileParty>.LocatorNodeIndex
		{
			get
			{
				return this._locatorNodeIndex;
			}
			set
			{
				this._locatorNodeIndex = value;
			}
		}

		// Token: 0x17000948 RID: 2376
		// (get) Token: 0x06002527 RID: 9511 RVA: 0x0009C858 File Offset: 0x0009AA58
		// (set) Token: 0x06002528 RID: 9512 RVA: 0x0009C860 File Offset: 0x0009AA60
		[CachedData]
		public PathFaceRecord CurrentNavigationFace
		{
			get
			{
				return this._currentNavigationFace;
			}
			private set
			{
				this._lastNavigationFace = this.CurrentNavigationFace;
				this._currentNavigationFace = value;
			}
		}

		// Token: 0x06002529 RID: 9513 RVA: 0x0009C878 File Offset: 0x0009AA78
		internal void HourlyTick()
		{
			if (this.IsActive)
			{
				if (this.LeaderHero != null && this.CurrentSettlement != null && this.CurrentSettlement == this.LeaderHero.HomeSettlement)
				{
					Hero leaderHero = this.LeaderHero;
					float passedTimeAtHomeSettlement = leaderHero.PassedTimeAtHomeSettlement;
					leaderHero.PassedTimeAtHomeSettlement = passedTimeAtHomeSettlement + 1f;
				}
				this.Ai.HourlyTick();
			}
		}

		// Token: 0x0600252A RID: 9514 RVA: 0x0009C8D4 File Offset: 0x0009AAD4
		internal void DailyTick()
		{
			this.RecentEventsMorale -= this.RecentEventsMorale * 0.1f;
			if (this.LeaderHero != null)
			{
				this.LeaderHero.PassedTimeAtHomeSettlement *= 0.9f;
			}
		}

		// Token: 0x17000949 RID: 2377
		// (get) Token: 0x0600252B RID: 9515 RVA: 0x0009C90E File Offset: 0x0009AB0E
		// (set) Token: 0x0600252C RID: 9516 RVA: 0x0009C916 File Offset: 0x0009AB16
		[CachedData]
		public Vec2 ErrorPosition { get; private set; }

		// Token: 0x0600252D RID: 9517 RVA: 0x0009C91F File Offset: 0x0009AB1F
		internal void TickForStationaryMobileParty(ref MobileParty.CachedPartyVariables variables, float dt, float realDt)
		{
			if (this.StationaryStartTime == CampaignTime.Never)
			{
				this.StationaryStartTime = CampaignTime.Now;
			}
			this.CheckIsDisorganized();
			this.DoUpdatePosition(ref variables, dt, realDt);
			this.DoErrorCorrections(ref variables, realDt);
		}

		// Token: 0x0600252E RID: 9518 RVA: 0x0009C955 File Offset: 0x0009AB55
		internal void TickForMovingMobileParty(ref MobileParty.CachedPartyVariables variables, float dt, float realDt)
		{
			this.ComputeNextMoveDistance(ref variables, dt);
			this.CommonMovingPartyTick(ref variables, dt, realDt);
		}

		// Token: 0x0600252F RID: 9519 RVA: 0x0009C968 File Offset: 0x0009AB68
		internal void TickForMovingArmyLeader(ref MobileParty.CachedPartyVariables variables, float dt, float realDt)
		{
			this.ComputeNextMoveDistanceForArmyLeader(ref variables, dt);
			this.CommonMovingPartyTick(ref variables, dt, realDt);
		}

		// Token: 0x06002530 RID: 9520 RVA: 0x0009C97B File Offset: 0x0009AB7B
		internal void CommonMovingPartyTick(ref MobileParty.CachedPartyVariables variables, float dt, float realDt)
		{
			this.StationaryStartTime = CampaignTime.Never;
			this.CheckIsDisorganized();
			this.Ai.DoAiPathMode(ref variables);
			this.DoUpdatePosition(ref variables, dt, realDt);
			this.DoErrorCorrections(ref variables, realDt);
		}

		// Token: 0x06002531 RID: 9521 RVA: 0x0009C9AC File Offset: 0x0009ABAC
		internal void InitializeCachedPartyVariables(ref MobileParty.CachedPartyVariables variables)
		{
			variables.HasMapEvent = (this.MapEvent != null);
			variables.CurrentPosition = this.Position2D;
			variables.TargetPartyPositionAtFrameStart = Vec2.Invalid;
			variables.LastCurrentPosition = this.Position2D;
			variables.IsAttachedArmyMember = false;
			variables.IsMoving = (this.IsMoving || this.IsMainParty);
			variables.IsArmyLeader = false;
			if (this.Army != null)
			{
				if (this.Army.LeaderParty == this)
				{
					variables.IsArmyLeader = true;
					return;
				}
				if (this.Army.LeaderParty.AttachedParties.Contains(this))
				{
					variables.IsAttachedArmyMember = true;
					variables.IsMoving = (this.IsMoving || this.Army.LeaderParty.IsMoving);
				}
			}
		}

		// Token: 0x06002532 RID: 9522 RVA: 0x0009CA6E File Offset: 0x0009AC6E
		internal void ComputeNextMoveDistanceForArmyLeader(ref MobileParty.CachedPartyVariables variables, float dt)
		{
			if (dt > 0f)
			{
				this.CalculateSpeedForPartyUnified();
				variables.NextMoveDistance = this.Speed * dt;
				return;
			}
			variables.NextMoveDistance = 0f;
		}

		// Token: 0x06002533 RID: 9523 RVA: 0x0009CA99 File Offset: 0x0009AC99
		internal void ComputeNextMoveDistance(ref MobileParty.CachedPartyVariables variables, float dt)
		{
			if (dt > 0f)
			{
				this.CalculateSpeed();
				variables.NextMoveDistance = this.Speed * dt;
				return;
			}
			variables.NextMoveDistance = 0f;
		}

		// Token: 0x06002534 RID: 9524 RVA: 0x0009CAC4 File Offset: 0x0009ACC4
		internal void UpdateStationaryTimer()
		{
			if (!this.IsMoving)
			{
				if (this.StationaryStartTime == CampaignTime.Never)
				{
					this.StationaryStartTime = CampaignTime.Now;
					return;
				}
			}
			else
			{
				this.StationaryStartTime = CampaignTime.Never;
			}
		}

		// Token: 0x06002535 RID: 9525 RVA: 0x0009CAF7 File Offset: 0x0009ACF7
		private void CheckIsDisorganized()
		{
			if (this._isDisorganized && this._disorganizedUntilTime.IsPast)
			{
				this.SetDisorganized(false);
			}
		}

		// Token: 0x06002536 RID: 9526 RVA: 0x0009CB15 File Offset: 0x0009AD15
		public void SetDisorganized(bool isDisorganized)
		{
			if (isDisorganized)
			{
				this._disorganizedUntilTime = CampaignTime.HoursFromNow(Campaign.Current.Models.PartyImpairmentModel.GetDisorganizedStateDuration(this));
			}
			this._isDisorganized = isDisorganized;
			this.UpdateVersionNo();
		}

		// Token: 0x06002537 RID: 9527 RVA: 0x0009CB48 File Offset: 0x0009AD48
		internal void DoUpdatePosition(ref MobileParty.CachedPartyVariables variables, float dt, float realDt)
		{
			variables.NextPosition = variables.CurrentPosition;
			Vec2 v = variables.CurrentPosition + this.EventPositionAdder + this.ArmyPositionAdder;
			Vec2 vec;
			if (variables.IsAttachedArmyMember)
			{
				if (variables.HasMapEvent || this.CurrentSettlement != null)
				{
					vec = Vec2.Zero;
				}
				else
				{
					Vec2 v2 = variables.HasMapEvent ? this.Army.LeaderParty.Position2D : this.Army.LeaderParty.Ai.NextTargetPosition;
					Vec2 v3;
					PathFaceRecord pathFaceRecord;
					bool flag;
					this.Army.LeaderParty.Ai.GetTargetPositionAndFace(ref variables, out v3, out pathFaceRecord, out flag);
					Vec2 armyFacing = ((v2 - this.Army.LeaderParty.Position2D).LengthSquared < 0.0025000002f) ? Vec2.FromRotation(this.Army.LeaderParty.Party.AverageBearingRotation) : (v2 - this.Army.LeaderParty.Position2D).Normalized();
					Vec2 v4 = armyFacing.TransformToParentUnitF(this.Army.GetRelativePositionForParty(this, armyFacing));
					vec = v2 + v4 - v;
					if ((v3 + v4 - v).LengthSquared < 0.010000001f || vec.LengthSquared < 0.010000001f)
					{
						vec = Vec2.Zero;
					}
					float num = vec.LeftVec().Normalized().DotProduct(this.Army.LeaderParty.Position2D + v4 - v);
					vec.RotateCCW((num < 0f) ? MathF.Max(num * 2f, -0.7853982f) : MathF.Min(num * 2f, 0.7853982f));
				}
			}
			else
			{
				vec = (variables.HasMapEvent ? this.Party.MapEvent.Position : this.Ai.NextTargetPosition) - v;
			}
			float num2 = vec.Normalize();
			if (num2 < variables.NextMoveDistance)
			{
				variables.NextMoveDistance = num2;
			}
			if (this.BesiegedSettlement == null && this.CurrentSettlement == null && (variables.NextMoveDistance > 0f || variables.HasMapEvent))
			{
				bool flag2 = false;
				Vec2 vec2 = this.Bearing;
				if (num2 > 0f)
				{
					flag2 = true;
					vec2 = vec;
					if (!variables.IsAttachedArmyMember || !variables.HasMapEvent)
					{
						this.Bearing = vec2;
					}
				}
				else if (variables.IsAttachedArmyMember && variables.HasMapEvent)
				{
					vec2 = this.Army.LeaderParty.Bearing;
					this.Bearing = vec2;
					flag2 = true;
				}
				if (flag2)
				{
					float num3 = MBMath.WrapAngle(this.Bearing.RotationInRadians - this.Party.AverageBearingRotation);
					float num4 = variables.HasMapEvent ? realDt : dt;
					this.Party.AverageBearingRotation += num3 * MathF.Min(num4 * 30f, 1f);
					this.Party.AverageBearingRotation = MBMath.WrapAngle(this.Party.AverageBearingRotation);
				}
				variables.NextPosition = variables.CurrentPosition + vec2 * variables.NextMoveDistance;
			}
		}

		// Token: 0x06002538 RID: 9528 RVA: 0x0009CE84 File Offset: 0x0009B084
		internal void DoErrorCorrections(ref MobileParty.CachedPartyVariables variables, float realDt)
		{
			float lengthSquared = this.ErrorPosition.LengthSquared;
			if (lengthSquared > 0f)
			{
				if (this.CurrentSettlement != null || !this.IsVisible)
				{
					this.ErrorPosition = Vec2.Zero;
				}
				if ((double)lengthSquared <= 49.0 * (double)realDt * (double)realDt)
				{
					this.ErrorPosition = Vec2.Zero;
					return;
				}
				this.ErrorPosition -= this.ErrorPosition.Normalized() * (7f * realDt);
			}
		}

		// Token: 0x06002539 RID: 9529 RVA: 0x0009CF10 File Offset: 0x0009B110
		internal void TickForMobileParty2(ref MobileParty.CachedPartyVariables variables, float realDt, ref int gridChangeCount, ref MobileParty[] gridChangeMobilePartyList)
		{
			variables.NextPathFaceRecord = Campaign.Current.MapSceneWrapper.GetFaceIndex(variables.NextPosition);
			if (variables.NextMoveDistance > 0f && variables.IsMoving && this.BesiegedSettlement == null && !variables.HasMapEvent)
			{
				if (variables.IsAttachedArmyMember && (this.Army.LeaderParty.Position2D - (this.Position2D + this.ArmyPositionAdder)).Length > 0.25f)
				{
					this._position2D = this.Army.LeaderParty.Position2D;
					this.ArmyPositionAdder += variables.NextPosition - this.Position2D;
					return;
				}
				PathFaceRecord nextPathFaceRecord = variables.NextPathFaceRecord;
				if (this.CurrentNavigationFace.IsValid() && this.CurrentNavigationFace.FaceIslandIndex == nextPathFaceRecord.FaceIslandIndex)
				{
					this.SetPositionParallel(variables, variables.NextPosition, ref gridChangeCount, ref gridChangeMobilePartyList);
				}
			}
		}

		// Token: 0x1700094A RID: 2378
		// (get) Token: 0x0600253A RID: 9530 RVA: 0x0009D020 File Offset: 0x0009B220
		// (set) Token: 0x0600253B RID: 9531 RVA: 0x0009D028 File Offset: 0x0009B228
		public Vec2 EventPositionAdder
		{
			get
			{
				return this._eventPositionAdder;
			}
			set
			{
				this.ErrorPosition += this._eventPositionAdder;
				this._eventPositionAdder = value;
				this.ErrorPosition -= this._eventPositionAdder;
			}
		}

		// Token: 0x1700094B RID: 2379
		// (get) Token: 0x0600253C RID: 9532 RVA: 0x0009D05F File Offset: 0x0009B25F
		// (set) Token: 0x0600253D RID: 9533 RVA: 0x0009D067 File Offset: 0x0009B267
		public bool IsVisible
		{
			get
			{
				return this._isVisible;
			}
			set
			{
				if (this._isVisible != value)
				{
					this._isVisible = value;
					this.Party.OnVisibilityChanged(value);
				}
			}
		}

		// Token: 0x1700094C RID: 2380
		// (get) Token: 0x0600253E RID: 9534 RVA: 0x0009D085 File Offset: 0x0009B285
		// (set) Token: 0x0600253F RID: 9535 RVA: 0x0009D090 File Offset: 0x0009B290
		public Vec2 Position2D
		{
			get
			{
				return this._position2D;
			}
			set
			{
				if (this._position2D != value)
				{
					this._position2D = value;
					Campaign campaign = Campaign.Current;
					campaign.MobilePartyLocator.UpdateLocator(this);
					if (campaign.MapSceneWrapper != null)
					{
						this.CurrentNavigationFace = campaign.MapSceneWrapper.GetFaceIndex(this._position2D);
					}
				}
			}
		}

		// Token: 0x06002540 RID: 9536 RVA: 0x0009D0E4 File Offset: 0x0009B2E4
		private void SetPositionParallel(MobileParty.CachedPartyVariables variables, Vec2 value, ref int GridChangeCounter, ref MobileParty[] GridChangeList)
		{
			if (this._position2D != value)
			{
				this._position2D = value;
				if (!Campaign.Current.MobilePartyLocator.CheckWhetherPositionsAreInSameNode(value, this))
				{
					int num = Interlocked.Increment(ref GridChangeCounter);
					GridChangeList[num] = this;
				}
				this.CurrentNavigationFace = variables.NextPathFaceRecord;
			}
		}

		// Token: 0x06002541 RID: 9537 RVA: 0x0009D132 File Offset: 0x0009B332
		public void SetCustomName(TextObject name)
		{
			this.CustomName = name;
		}

		// Token: 0x06002542 RID: 9538 RVA: 0x0009D13B File Offset: 0x0009B33B
		public void SetPartyUsedByQuest(bool isActivelyUsed)
		{
			if (this._isCurrentlyUsedByAQuest != isActivelyUsed)
			{
				this._isCurrentlyUsedByAQuest = isActivelyUsed;
				CampaignEventDispatcher.Instance.OnMobilePartyQuestStatusChanged(this, isActivelyUsed);
			}
		}

		// Token: 0x06002543 RID: 9539 RVA: 0x0009D159 File Offset: 0x0009B359
		public void ResetTargetParty()
		{
			this.TargetParty = null;
		}

		// Token: 0x1700094D RID: 2381
		// (get) Token: 0x06002544 RID: 9540 RVA: 0x0009D162 File Offset: 0x0009B362
		// (set) Token: 0x06002545 RID: 9541 RVA: 0x0009D186 File Offset: 0x0009B386
		public bool IsInspected
		{
			get
			{
				return (this.Army != null && this.Army == MobileParty.MainParty.Army) || this._isInspected;
			}
			set
			{
				this._isInspected = value;
			}
		}

		// Token: 0x06002546 RID: 9542 RVA: 0x0009D18F File Offset: 0x0009B38F
		public void IgnoreForHours(float hours)
		{
			this._ignoredUntilTime = CampaignTime.HoursFromNow(hours);
		}

		// Token: 0x06002547 RID: 9543 RVA: 0x0009D19D File Offset: 0x0009B39D
		public void IgnoreByOtherPartiesTill(CampaignTime time)
		{
			this._ignoredUntilTime = time;
		}

		// Token: 0x1700094E RID: 2382
		// (get) Token: 0x06002548 RID: 9544 RVA: 0x0009D1A6 File Offset: 0x0009B3A6
		public Vec2 GetPosition2D
		{
			get
			{
				return this.Position2D;
			}
		}

		// Token: 0x1700094F RID: 2383
		// (get) Token: 0x06002549 RID: 9545 RVA: 0x0009D1B0 File Offset: 0x0009B3B0
		public int TotalWage
		{
			get
			{
				return (int)Campaign.Current.Models.PartyWageModel.GetTotalWage(this, false).ResultNumber;
			}
		}

		// Token: 0x17000950 RID: 2384
		// (get) Token: 0x0600254A RID: 9546 RVA: 0x0009D1DC File Offset: 0x0009B3DC
		public ExplainedNumber TotalWageExplained
		{
			get
			{
				return Campaign.Current.Models.PartyWageModel.GetTotalWage(this, true);
			}
		}

		// Token: 0x17000951 RID: 2385
		// (get) Token: 0x0600254B RID: 9547 RVA: 0x0009D1F4 File Offset: 0x0009B3F4
		public MapEvent MapEvent
		{
			get
			{
				return this.Party.MapEvent;
			}
		}

		// Token: 0x0600254C RID: 9548 RVA: 0x0009D204 File Offset: 0x0009B404
		internal void OnRemovedFromArmyInternal()
		{
			this.ResetTargetParty();
			if (this.IsActive && this.LeaderHero != null)
			{
				if (this.BesiegedSettlement != null && this.Army.LeaderParty != this)
				{
					if (!this.BesiegedSettlement.SiegeEvent.BesiegerCamp.HasInvolvedPartyForEventType(this.Party, MapEvent.BattleTypes.Siege))
					{
						if (this == MobileParty.MainParty)
						{
							this.Ai.SetMoveModeHold();
							return;
						}
						if (this.MapEvent == null)
						{
							this.Ai.SetMoveBesiegeSettlement(this.BesiegedSettlement);
							return;
						}
					}
				}
				else
				{
					if (this.CurrentSettlement == null)
					{
						this.Ai.SetMoveModeHold();
						return;
					}
					if (this.Party.MapEvent == null)
					{
						this.Ai.SetMoveGoToSettlement(this.CurrentSettlement);
					}
				}
			}
		}

		// Token: 0x0600254D RID: 9549 RVA: 0x0009D2C4 File Offset: 0x0009B4C4
		private void OnRemoveParty()
		{
			this.Army = null;
			this.CurrentSettlement = null;
			this.AttachedTo = null;
			this.BesiegerCamp = null;
			List<Settlement> list = new List<Settlement>();
			if (this.CurrentSettlement != null)
			{
				list.Add(this.CurrentSettlement);
			}
			else if ((this.IsGarrison || this.IsMilitia || this.IsBandit || this.IsVillager) && this.HomeSettlement != null)
			{
				list.Add(this.HomeSettlement);
			}
			PartyComponent partyComponent = this.PartyComponent;
			if (partyComponent != null)
			{
				partyComponent.Finish();
			}
			this.ActualClan = null;
			Campaign.Current.CampaignObjectManager.RemoveMobileParty(this);
			foreach (Settlement settlement in list)
			{
				settlement.SettlementComponent.OnRelatedPartyRemoved(this);
			}
		}

		// Token: 0x0600254E RID: 9550 RVA: 0x0009D3AC File Offset: 0x0009B5AC
		public void SetPartyObjective(MobileParty.PartyObjective objective)
		{
			this.Objective = objective;
		}

		// Token: 0x0600254F RID: 9551 RVA: 0x0009D3B8 File Offset: 0x0009B5B8
		public void UpdateVersionNo()
		{
			int versionNo = this.VersionNo;
			this.VersionNo = versionNo + 1;
		}

		// Token: 0x17000952 RID: 2386
		// (get) Token: 0x06002550 RID: 9552 RVA: 0x0009D3D5 File Offset: 0x0009B5D5
		public TroopRoster MemberRoster
		{
			get
			{
				return this.Party.MemberRoster;
			}
		}

		// Token: 0x17000953 RID: 2387
		// (get) Token: 0x06002551 RID: 9553 RVA: 0x0009D3E2 File Offset: 0x0009B5E2
		public TroopRoster PrisonRoster
		{
			get
			{
				return this.Party.PrisonRoster;
			}
		}

		// Token: 0x06002552 RID: 9554 RVA: 0x0009D3F0 File Offset: 0x0009B5F0
		private bool IsLastSpeedCacheInvalid()
		{
			Hero leaderHero = this.LeaderHero;
			bool flag = !this.IsActive || leaderHero == null || leaderHero.PartyBelongedToAsPrisoner != null;
			bool isNight = Campaign.Current.IsNight;
			return this._lastNavigationFace.FaceIndex != this.CurrentNavigationFace.FaceIndex || this._partyLastCheckIsPrisoner != flag || this._partyLastCheckAtNight != isNight;
		}

		// Token: 0x06002553 RID: 9555 RVA: 0x0009D458 File Offset: 0x0009B658
		private bool IsBaseSpeedCacheInvalid()
		{
			MapWeatherModel.WeatherEventEffectOnTerrain weatherEffectOnTerrainForPosition = Campaign.Current.Models.MapWeatherModel.GetWeatherEffectOnTerrainForPosition(this.Position2D);
			return this._partyPureSpeedLastCheckVersion != this.VersionNo || this._itemRosterVersionNo != this.Party.ItemRoster.VersionNo || this._lastWeatherTerrainEffect != weatherEffectOnTerrainForPosition;
		}

		// Token: 0x06002554 RID: 9556 RVA: 0x0009D4B4 File Offset: 0x0009B6B4
		private float CalculateSpeedForPartyUnified()
		{
			bool flag = false;
			if (this.IsBaseSpeedCacheInvalid())
			{
				if (this.Army != null && this.Army.LeaderParty.AttachedParties.Contains(this))
				{
					this._lastCalculatedBaseSpeedExplained = this.Army.LeaderParty._lastCalculatedBaseSpeedExplained;
				}
				else
				{
					this._lastCalculatedBaseSpeedExplained = Campaign.Current.Models.PartySpeedCalculatingModel.CalculateBaseSpeed(this, false, 0, 0);
				}
				MapWeatherModel.WeatherEventEffectOnTerrain weatherEffectOnTerrainForPosition = Campaign.Current.Models.MapWeatherModel.GetWeatherEffectOnTerrainForPosition(this.Position2D);
				this._partyPureSpeedLastCheckVersion = this.VersionNo;
				this._itemRosterVersionNo = this.Party.ItemRoster.VersionNo;
				this._lastWeatherTerrainEffect = weatherEffectOnTerrainForPosition;
				flag = true;
			}
			if (flag)
			{
				this._lastCalculatedSpeed = Campaign.Current.Models.PartySpeedCalculatingModel.CalculateFinalSpeed(this, this._lastCalculatedBaseSpeedExplained).ResultNumber;
			}
			else if (this.IsLastSpeedCacheInvalid())
			{
				Hero leaderHero = this.LeaderHero;
				bool partyLastCheckIsPrisoner = !this.IsActive || leaderHero == null || leaderHero.PartyBelongedToAsPrisoner != null;
				bool isNight = Campaign.Current.IsNight;
				this._lastNavigationFace = this.CurrentNavigationFace;
				this._partyLastCheckIsPrisoner = partyLastCheckIsPrisoner;
				this._partyLastCheckAtNight = isNight;
				this._lastCalculatedSpeed = Campaign.Current.Models.PartySpeedCalculatingModel.CalculateFinalSpeed(this, this._lastCalculatedBaseSpeedExplained).ResultNumber;
			}
			return this._lastCalculatedSpeed;
		}

		// Token: 0x06002555 RID: 9557 RVA: 0x0009D618 File Offset: 0x0009B818
		private float CalculateSpeed()
		{
			if (this.Army != null)
			{
				if (this.Army.LeaderParty.AttachedParties.Contains(this))
				{
					Vec2 armyFacing = (((this.Army.LeaderParty.MapEvent != null) ? this.Army.LeaderParty.Position2D : this.Army.LeaderParty.Ai.NextTargetPosition) - this.Army.LeaderParty.Position2D).Normalized();
					Vec2 v = this.Army.LeaderParty.Position2D + armyFacing.TransformToParentUnitF(this.Army.GetRelativePositionForParty(this, armyFacing));
					float num = this.Bearing.DotProduct(v - this.VisualPosition2DWithoutError);
					return this.Army.LeaderParty._lastCalculatedSpeed * MBMath.ClampFloat(1f + num * 1f, 0.7f, 1.3f);
				}
			}
			else if (this.DefaultBehavior == AiBehavior.EscortParty && this.TargetParty != null && this._lastCalculatedSpeed > this.TargetParty._lastCalculatedSpeed)
			{
				return this.TargetParty._lastCalculatedSpeed;
			}
			return this.CalculateSpeedForPartyUnified();
		}

		// Token: 0x17000954 RID: 2388
		// (get) Token: 0x06002556 RID: 9558 RVA: 0x0009D74C File Offset: 0x0009B94C
		public ItemRoster ItemRoster
		{
			get
			{
				return this.Party.ItemRoster;
			}
		}

		// Token: 0x06002557 RID: 9559 RVA: 0x0009D759 File Offset: 0x0009B959
		public bool IsSpotted()
		{
			return this.IsVisible;
		}

		// Token: 0x17000955 RID: 2389
		// (get) Token: 0x06002558 RID: 9560 RVA: 0x0009D761 File Offset: 0x0009B961
		public bool IsMainParty
		{
			get
			{
				return this == MobileParty.MainParty;
			}
		}

		// Token: 0x06002559 RID: 9561 RVA: 0x0009D76B File Offset: 0x0009B96B
		public int AddElementToMemberRoster(CharacterObject element, int numberToAdd, bool insertAtFront = false)
		{
			return this.Party.AddElementToMemberRoster(element, numberToAdd, insertAtFront);
		}

		// Token: 0x0600255A RID: 9562 RVA: 0x0009D77B File Offset: 0x0009B97B
		public int AddPrisoner(CharacterObject element, int numberToAdd)
		{
			return this.Party.AddPrisoner(element, numberToAdd);
		}

		// Token: 0x17000956 RID: 2390
		// (get) Token: 0x0600255B RID: 9563 RVA: 0x0009D78C File Offset: 0x0009B98C
		public IFaction MapFaction
		{
			get
			{
				IFaction result;
				if (this.ActualClan != null)
				{
					result = this.ActualClan.MapFaction;
				}
				else if (this.Party.Owner != null)
				{
					if (this.Party.Owner == Hero.MainHero)
					{
						result = this.Party.Owner.MapFaction;
					}
					else if (this.Party.Owner.IsNotable)
					{
						result = this.Party.Owner.HomeSettlement.MapFaction;
					}
					else
					{
						if (this.IsMilitia || this.IsGarrison || this.IsVillager)
						{
							Settlement homeSettlement = this.HomeSettlement;
							if (((homeSettlement != null) ? homeSettlement.OwnerClan : null) != null)
							{
								return this.HomeSettlement.OwnerClan.MapFaction;
							}
						}
						if (this.IsCaravan || this.IsBanditBossParty)
						{
							result = this.Party.Owner.MapFaction;
						}
						else if (this._isCurrentlyUsedByAQuest && this.Party.Owner != null)
						{
							result = this.Party.Owner.MapFaction;
						}
						else
						{
							result = ((this.LeaderHero != null) ? this.LeaderHero.MapFaction : null);
						}
					}
				}
				else if (this.HomeSettlement != null)
				{
					result = this.HomeSettlement.OwnerClan.MapFaction;
				}
				else
				{
					result = ((this.LeaderHero != null) ? this.LeaderHero.MapFaction : null);
				}
				return result;
			}
		}

		// Token: 0x17000957 RID: 2391
		// (get) Token: 0x0600255C RID: 9564 RVA: 0x0009D8F0 File Offset: 0x0009BAF0
		public TextObject ArmyName
		{
			get
			{
				if (this.Army == null || this.Army.LeaderParty != this)
				{
					return this.Name;
				}
				return this.Army.Name;
			}
		}

		// Token: 0x17000958 RID: 2392
		// (get) Token: 0x0600255D RID: 9565 RVA: 0x0009D91A File Offset: 0x0009BB1A
		public SiegeEvent SiegeEvent
		{
			get
			{
				BesiegerCamp besiegerCamp = this.BesiegerCamp;
				if (besiegerCamp == null)
				{
					return null;
				}
				return besiegerCamp.SiegeEvent;
			}
		}

		// Token: 0x17000959 RID: 2393
		// (get) Token: 0x0600255E RID: 9566 RVA: 0x0009D92D File Offset: 0x0009BB2D
		public float Food
		{
			get
			{
				return (float)this.Party.RemainingFoodPercentage * 0.01f + (float)this.TotalFoodAtInventory;
			}
		}

		// Token: 0x0600255F RID: 9567 RVA: 0x0009D94C File Offset: 0x0009BB4C
		public Vec3 GetLogicalPosition()
		{
			float z = 0f;
			Campaign.Current.MapSceneWrapper.GetHeightAtPoint(this.Position2D, ref z);
			return new Vec3(this.Position2D.x, this.Position2D.y, z, -1f);
		}

		// Token: 0x1700095A RID: 2394
		// (get) Token: 0x06002560 RID: 9568 RVA: 0x0009D998 File Offset: 0x0009BB98
		public int TotalFoodAtInventory
		{
			get
			{
				return this.ItemRoster.TotalFood;
			}
		}

		// Token: 0x1700095B RID: 2395
		// (get) Token: 0x06002561 RID: 9569 RVA: 0x0009D9A5 File Offset: 0x0009BBA5
		public float TotalWeightCarried
		{
			get
			{
				return this.ItemRoster.TotalWeight;
			}
		}

		// Token: 0x1700095C RID: 2396
		// (get) Token: 0x06002562 RID: 9570 RVA: 0x0009D9B4 File Offset: 0x0009BBB4
		public float SeeingRange
		{
			get
			{
				return Campaign.Current.Models.MapVisibilityModel.GetPartySpottingRange(this, false).ResultNumber;
			}
		}

		// Token: 0x1700095D RID: 2397
		// (get) Token: 0x06002563 RID: 9571 RVA: 0x0009D9DF File Offset: 0x0009BBDF
		public Settlement BesiegedSettlement
		{
			get
			{
				BesiegerCamp besiegerCamp = this.BesiegerCamp;
				if (besiegerCamp == null)
				{
					return null;
				}
				return besiegerCamp.SiegeEvent.BesiegedSettlement;
			}
		}

		// Token: 0x06002564 RID: 9572 RVA: 0x0009D9F8 File Offset: 0x0009BBF8
		public float GetTotalStrengthWithFollowers(bool includeNonAttachedArmyMembers = true)
		{
			MobileParty mobileParty = (this.DefaultBehavior == AiBehavior.EscortParty) ? this.TargetParty : this;
			float num = mobileParty.Party.TotalStrength;
			if (mobileParty.Army != null && mobileParty == mobileParty.Army.LeaderParty)
			{
				foreach (MobileParty mobileParty2 in mobileParty.Army.Parties)
				{
					if (mobileParty2.Army.LeaderParty != mobileParty2 && (mobileParty2.AttachedTo != null || includeNonAttachedArmyMembers))
					{
						num += mobileParty2.Party.TotalStrength;
					}
				}
			}
			return num;
		}

		// Token: 0x06002565 RID: 9573 RVA: 0x0009DAAC File Offset: 0x0009BCAC
		private void FillPartyStacks(PartyTemplateObject pt, int troopNumberLimit = -1)
		{
			if (this.IsBandit)
			{
				float playerProgress = Campaign.Current.PlayerProgress;
				float num = 0.4f + 0.8f * playerProgress;
				int num2 = MBRandom.RandomInt(2);
				float num3 = (num2 == 0) ? MBRandom.RandomFloat : (MBRandom.RandomFloat * MBRandom.RandomFloat * MBRandom.RandomFloat * 4f);
				float num4 = (num2 == 0) ? (num3 * 0.8f + 0.2f) : (1f + num3);
				float randomFloat = MBRandom.RandomFloat;
				float randomFloat2 = MBRandom.RandomFloat;
				float randomFloat3 = MBRandom.RandomFloat;
				float f = (pt.Stacks.Count > 0) ? ((float)pt.Stacks[0].MinValue + num * num4 * randomFloat * (float)(pt.Stacks[0].MaxValue - pt.Stacks[0].MinValue)) : 0f;
				float f2 = (pt.Stacks.Count > 1) ? ((float)pt.Stacks[1].MinValue + num * num4 * randomFloat2 * (float)(pt.Stacks[1].MaxValue - pt.Stacks[1].MinValue)) : 0f;
				float f3 = (pt.Stacks.Count > 2) ? ((float)pt.Stacks[2].MinValue + num * num4 * randomFloat3 * (float)(pt.Stacks[2].MaxValue - pt.Stacks[2].MinValue)) : 0f;
				this.AddElementToMemberRoster(pt.Stacks[0].Character, MBRandom.RoundRandomized(f), false);
				if (pt.Stacks.Count > 1)
				{
					this.AddElementToMemberRoster(pt.Stacks[1].Character, MBRandom.RoundRandomized(f2), false);
				}
				if (pt.Stacks.Count > 2)
				{
					this.AddElementToMemberRoster(pt.Stacks[2].Character, MBRandom.RoundRandomized(f3), false);
					return;
				}
			}
			else
			{
				if (troopNumberLimit < 0)
				{
					float playerProgress2 = Campaign.Current.PlayerProgress;
					for (int i = 0; i < pt.Stacks.Count; i++)
					{
						int numberToAdd = (int)(playerProgress2 * (float)(pt.Stacks[i].MaxValue - pt.Stacks[i].MinValue)) + pt.Stacks[i].MinValue;
						CharacterObject character = pt.Stacks[i].Character;
						this.AddElementToMemberRoster(character, numberToAdd, false);
					}
					return;
				}
				for (int j = 0; j < troopNumberLimit; j++)
				{
					int num5 = -1;
					float num6 = 0f;
					for (int k = 0; k < pt.Stacks.Count; k++)
					{
						num6 += ((this.IsGarrison && pt.Stacks[k].Character.IsRanged) ? 6f : ((this.IsGarrison && !pt.Stacks[k].Character.IsMounted) ? 2f : 1f)) * ((float)(pt.Stacks[k].MaxValue + pt.Stacks[k].MinValue) / 2f);
					}
					float num7 = MBRandom.RandomFloat * num6;
					for (int l = 0; l < pt.Stacks.Count; l++)
					{
						num7 -= ((this.IsGarrison && pt.Stacks[l].Character.IsRanged) ? 6f : ((this.IsGarrison && !pt.Stacks[l].Character.IsMounted) ? 2f : 1f)) * ((float)(pt.Stacks[l].MaxValue + pt.Stacks[l].MinValue) / 2f);
						if (num7 < 0f)
						{
							num5 = l;
							break;
						}
					}
					if (num5 < 0)
					{
						num5 = 0;
					}
					CharacterObject character2 = pt.Stacks[num5].Character;
					this.AddElementToMemberRoster(character2, 1, false);
				}
				bool isVillager = this.IsVillager;
			}
		}

		// Token: 0x06002566 RID: 9574 RVA: 0x0009DEF4 File Offset: 0x0009C0F4
		private void OnPartyJoinedSiegeInternal()
		{
			this._besiegerCamp.AddSiegePartyInternal(this);
			this._besiegerCamp.SetSiegeCampPartyPosition(this);
		}

		// Token: 0x06002567 RID: 9575 RVA: 0x0009DF0E File Offset: 0x0009C10E
		private void OnPartyLeftSiegeInternal()
		{
			this._besiegerCamp.RemoveSiegePartyInternal(this);
			this.EventPositionAdder = Vec2.Zero;
			this.ErrorPosition = Vec2.Zero;
		}

		// Token: 0x06002568 RID: 9576 RVA: 0x0009DF34 File Offset: 0x0009C134
		public bool HasPerk(PerkObject perk, bool checkSecondaryRole = false)
		{
			switch (checkSecondaryRole ? perk.SecondaryRole : perk.PrimaryRole)
			{
			case SkillEffect.PerkRole.ClanLeader:
				if (this.LeaderHero != null)
				{
					Clan clan = this.LeaderHero.Clan;
					bool? flag;
					if (clan == null)
					{
						flag = null;
					}
					else
					{
						Hero leader = clan.Leader;
						flag = ((leader != null) ? new bool?(leader.GetPerkValue(perk)) : null);
					}
					return flag ?? false;
				}
				return false;
			case SkillEffect.PerkRole.ArmyCommander:
			{
				Army army = this.Army;
				bool? flag2;
				if (army == null)
				{
					flag2 = null;
				}
				else
				{
					MobileParty leaderParty = army.LeaderParty;
					if (leaderParty == null)
					{
						flag2 = null;
					}
					else
					{
						Hero leaderHero = leaderParty.LeaderHero;
						flag2 = ((leaderHero != null) ? new bool?(leaderHero.GetPerkValue(perk)) : null);
					}
				}
				return flag2 ?? false;
			}
			case SkillEffect.PerkRole.PartyLeader:
			{
				Hero leaderHero2 = this.LeaderHero;
				return leaderHero2 != null && leaderHero2.GetPerkValue(perk);
			}
			case SkillEffect.PerkRole.Surgeon:
			{
				Hero effectiveSurgeon = this.EffectiveSurgeon;
				return effectiveSurgeon != null && effectiveSurgeon.GetPerkValue(perk);
			}
			case SkillEffect.PerkRole.Engineer:
			{
				Hero effectiveEngineer = this.EffectiveEngineer;
				return effectiveEngineer != null && effectiveEngineer.GetPerkValue(perk);
			}
			case SkillEffect.PerkRole.Scout:
			{
				Hero effectiveScout = this.EffectiveScout;
				return effectiveScout != null && effectiveScout.GetPerkValue(perk);
			}
			case SkillEffect.PerkRole.Quartermaster:
			{
				Hero effectiveQuartermaster = this.EffectiveQuartermaster;
				return effectiveQuartermaster != null && effectiveQuartermaster.GetPerkValue(perk);
			}
			case SkillEffect.PerkRole.PartyMember:
				foreach (TroopRosterElement troopRosterElement in this.MemberRoster.GetTroopRoster())
				{
					if (troopRosterElement.Character.IsHero && troopRosterElement.Character.HeroObject.GetPerkValue(perk))
					{
						return true;
					}
				}
				return false;
			case SkillEffect.PerkRole.Personal:
			{
				Debug.FailedAssert("personal perk is called in party", "C:\\Develop\\MB3\\Source\\Bannerlord\\TaleWorlds.CampaignSystem\\Party\\MobileParty.cs", "HasPerk", 1986);
				Hero leaderHero3 = this.LeaderHero;
				return leaderHero3 != null && leaderHero3.GetPerkValue(perk);
			}
			}
			return false;
		}

		// Token: 0x1700095E RID: 2398
		// (get) Token: 0x06002569 RID: 9577 RVA: 0x0009E140 File Offset: 0x0009C340
		public bool IsEngaging
		{
			get
			{
				return this.DefaultBehavior == AiBehavior.EngageParty || this.ShortTermBehavior == AiBehavior.EngageParty;
			}
		}

		// Token: 0x0600256A RID: 9578 RVA: 0x0009E156 File Offset: 0x0009C356
		public SkillEffect.PerkRole GetHeroPerkRole(Hero hero)
		{
			if (this.Engineer == hero)
			{
				return SkillEffect.PerkRole.Engineer;
			}
			if (this.Quartermaster == hero)
			{
				return SkillEffect.PerkRole.Quartermaster;
			}
			if (this.Surgeon == hero)
			{
				return SkillEffect.PerkRole.Surgeon;
			}
			if (this.Scout == hero)
			{
				return SkillEffect.PerkRole.Scout;
			}
			return SkillEffect.PerkRole.None;
		}

		// Token: 0x0600256B RID: 9579 RVA: 0x0009E188 File Offset: 0x0009C388
		public void SetHeroPerkRole(Hero hero, SkillEffect.PerkRole perkRole)
		{
			switch (perkRole)
			{
			case SkillEffect.PerkRole.None:
			case SkillEffect.PerkRole.Ruler:
			case SkillEffect.PerkRole.ClanLeader:
			case SkillEffect.PerkRole.Governor:
			case SkillEffect.PerkRole.ArmyCommander:
			case SkillEffect.PerkRole.PartyLeader:
			case SkillEffect.PerkRole.PartyOwner:
			case SkillEffect.PerkRole.PartyMember:
			case SkillEffect.PerkRole.Personal:
			case SkillEffect.PerkRole.Captain:
			case SkillEffect.PerkRole.NumberOfPerkRoles:
				break;
			case SkillEffect.PerkRole.Surgeon:
				this.SetPartySurgeon(hero);
				return;
			case SkillEffect.PerkRole.Engineer:
				this.SetPartyEngineer(hero);
				return;
			case SkillEffect.PerkRole.Scout:
				this.SetPartyScout(hero);
				return;
			case SkillEffect.PerkRole.Quartermaster:
				this.SetPartyQuartermaster(hero);
				break;
			default:
				return;
			}
		}

		// Token: 0x0600256C RID: 9580 RVA: 0x0009E1F8 File Offset: 0x0009C3F8
		public void RemoveHeroPerkRole(Hero hero)
		{
			if (this.Engineer == hero)
			{
				this.Engineer = null;
			}
			if (this.Quartermaster == hero)
			{
				this.Quartermaster = null;
			}
			if (this.Surgeon == hero)
			{
				this.Surgeon = null;
			}
			if (this.Scout == hero)
			{
				this.Scout = null;
			}
			this.ResetCached();
		}

		// Token: 0x0600256D RID: 9581 RVA: 0x0009E24C File Offset: 0x0009C44C
		public Hero GetRoleHolder(SkillEffect.PerkRole perkRole)
		{
			switch (perkRole)
			{
			case SkillEffect.PerkRole.PartyLeader:
				return this.LeaderHero;
			case SkillEffect.PerkRole.Surgeon:
				return this.Surgeon;
			case SkillEffect.PerkRole.Engineer:
				return this.Engineer;
			case SkillEffect.PerkRole.Scout:
				return this.Scout;
			case SkillEffect.PerkRole.Quartermaster:
				return this.Quartermaster;
			}
			return null;
		}

		// Token: 0x0600256E RID: 9582 RVA: 0x0009E2A0 File Offset: 0x0009C4A0
		public Hero GetEffectiveRoleHolder(SkillEffect.PerkRole perkRole)
		{
			switch (perkRole)
			{
			case SkillEffect.PerkRole.PartyLeader:
				return this.LeaderHero;
			case SkillEffect.PerkRole.Surgeon:
				return this.EffectiveSurgeon;
			case SkillEffect.PerkRole.Engineer:
				return this.EffectiveEngineer;
			case SkillEffect.PerkRole.Scout:
				return this.EffectiveScout;
			case SkillEffect.PerkRole.Quartermaster:
				return this.EffectiveQuartermaster;
			}
			return null;
		}

		// Token: 0x1700095F RID: 2399
		// (get) Token: 0x0600256F RID: 9583 RVA: 0x0009E2F3 File Offset: 0x0009C4F3
		internal bool IsCurrentlyEngagingSettlement
		{
			get
			{
				return this.ShortTermBehavior == AiBehavior.GoToSettlement || this.ShortTermBehavior == AiBehavior.RaidSettlement || this.ShortTermBehavior == AiBehavior.AssaultSettlement;
			}
		}

		// Token: 0x06002570 RID: 9584 RVA: 0x0009E314 File Offset: 0x0009C514
		public int GetNumDaysForFoodToLast()
		{
			int num = this.ItemRoster.TotalFood;
			num *= 100;
			if (this == MobileParty.MainParty)
			{
				num += this.Party.RemainingFoodPercentage;
			}
			return (int)((float)num / (100f * -this.FoodChange));
		}

		// Token: 0x17000960 RID: 2400
		// (get) Token: 0x06002571 RID: 9585 RVA: 0x0009E359 File Offset: 0x0009C559
		internal bool IsCurrentlyEngagingParty
		{
			get
			{
				return this.ShortTermBehavior == AiBehavior.EngageParty;
			}
		}

		// Token: 0x06002572 RID: 9586 RVA: 0x0009E364 File Offset: 0x0009C564
		public Vec3 GetPosition()
		{
			return this.GetLogicalPosition();
		}

		// Token: 0x17000961 RID: 2401
		// (get) Token: 0x06002573 RID: 9587 RVA: 0x0009E36C File Offset: 0x0009C56C
		public bool IsCurrentlyGoingToSettlement
		{
			get
			{
				return this.ShortTermBehavior == AiBehavior.GoToSettlement;
			}
		}

		// Token: 0x06002574 RID: 9588 RVA: 0x0009E378 File Offset: 0x0009C578
		public float GetTrackDistanceToMainAgent()
		{
			return this.GetPosition().Distance(Hero.MainHero.GetPosition());
		}

		// Token: 0x17000962 RID: 2402
		// (get) Token: 0x06002575 RID: 9589 RVA: 0x0009E3A0 File Offset: 0x0009C5A0
		public float PartySizeRatio
		{
			get
			{
				int versionNo = this.Party.MemberRoster.VersionNo;
				float cachedPartySizeRatio = this._cachedPartySizeRatio;
				if (this._partySizeRatioLastCheckVersion != versionNo || this == MobileParty.MainParty)
				{
					this._partySizeRatioLastCheckVersion = versionNo;
					this._cachedPartySizeRatio = (float)this.Party.NumberOfAllMembers / (float)this.Party.PartySizeLimit;
					cachedPartySizeRatio = this._cachedPartySizeRatio;
				}
				return cachedPartySizeRatio;
			}
		}

		// Token: 0x17000963 RID: 2403
		// (get) Token: 0x06002576 RID: 9590 RVA: 0x0009E404 File Offset: 0x0009C604
		public int LimitedPartySize
		{
			get
			{
				if (!this.HasLimitedWage())
				{
					return this.Party.PartySizeLimit;
				}
				int paymentLimit = this.Party.MobileParty.PaymentLimit;
				if (this._latestUsedPaymentRatio != paymentLimit || this == MobileParty.MainParty)
				{
					this._latestUsedPaymentRatio = paymentLimit;
					int num = Math.Min((this.LeaderHero != null && this.Party.Owner != null && this.Party.Owner.Clan != null && this.LeaderHero != this.Party.Owner.Clan.Leader) ? this.LeaderHero.CharacterObject.TroopWage : 0, this.TotalWage);
					int a = (int)((float)(this.PaymentLimit - num) / Campaign.Current.AverageWage) + 1;
					int num2 = MathF.Max(1, MathF.Min(a, this.Party.PartySizeLimit));
					this._cachedPartySizeLimit = num2;
					return num2;
				}
				return this._cachedPartySizeLimit;
			}
		}

		// Token: 0x06002577 RID: 9591 RVA: 0x0009E4F8 File Offset: 0x0009C6F8
		public bool CheckTracked(BasicCharacterObject basicCharacter)
		{
			return this.MemberRoster.GetTroopRoster().Any((TroopRosterElement t) => t.Character == basicCharacter) || this.PrisonRoster.GetTroopRoster().Any((TroopRosterElement t) => t.Character == basicCharacter);
		}

		// Token: 0x17000964 RID: 2404
		// (get) Token: 0x06002578 RID: 9592 RVA: 0x0009E54E File Offset: 0x0009C74E
		public Vec2 VisualPosition2DWithoutError
		{
			get
			{
				return this.Position2D + this.EventPositionAdder + this.ArmyPositionAdder;
			}
		}

		// Token: 0x06002579 RID: 9593 RVA: 0x0009E56C File Offset: 0x0009C76C
		private Settlement DetermineRelatedBesiegedSettlementWhileDestroyingParty()
		{
			Settlement settlement = this.BesiegedSettlement;
			if (settlement == null)
			{
				settlement = ((this.ShortTermBehavior == AiBehavior.AssaultSettlement) ? this.ShortTermTargetSettlement : null);
			}
			if (settlement == null && (this.IsGarrison || this.IsMilitia) && this.CurrentSettlement != null)
			{
				MobileParty lastAttackerParty = this.CurrentSettlement.LastAttackerParty;
				MapEvent mapEvent = (lastAttackerParty != null) ? lastAttackerParty.MapEvent : null;
				if (mapEvent != null && (mapEvent.IsSiegeAssault || mapEvent.IsSiegeOutside || mapEvent.IsSallyOut) && mapEvent.DefeatedSide != BattleSideEnum.None && mapEvent.State == MapEventState.WaitingRemoval)
				{
					settlement = this.CurrentSettlement;
				}
			}
			return settlement;
		}

		// Token: 0x0600257A RID: 9594 RVA: 0x0009E600 File Offset: 0x0009C800
		public void RemoveParty()
		{
			this.IsActive = false;
			this.IsVisible = false;
			Settlement settlement = this.DetermineRelatedBesiegedSettlementWhileDestroyingParty();
			Campaign campaign = Campaign.Current;
			this.AttachedTo = null;
			this.BesiegerCamp = null;
			this.ReleaseHeroPrisoners();
			this.ItemRoster.Clear();
			this.MemberRoster.Reset();
			this.PrisonRoster.Reset();
			Campaign.Current.MobilePartyLocator.RemoveLocatable(this);
			Campaign.Current.VisualTrackerManager.RemoveTrackedObject(this, true);
			CampaignEventDispatcher.Instance.OnPartyRemoved(this.Party);
			GC.SuppressFinalize(this.Party);
			foreach (MobileParty mobileParty in campaign.MobileParties)
			{
				bool flag = mobileParty.Ai.AiBehaviorPartyBase == this.Party || (mobileParty.TargetSettlement != null && mobileParty.TargetSettlement == settlement && mobileParty.CurrentSettlement != settlement) || (mobileParty.ShortTermTargetSettlement != null && mobileParty.ShortTermTargetSettlement == settlement && mobileParty.CurrentSettlement != settlement);
				if (mobileParty.TargetParty != null && mobileParty.TargetParty == this)
				{
					mobileParty.ResetTargetParty();
					flag = true;
				}
				if (flag && mobileParty.TargetSettlement != null && (mobileParty.MapEvent == null || mobileParty.MapEvent.IsFinalized) && mobileParty.DefaultBehavior == AiBehavior.GoToSettlement)
				{
					Settlement targetSettlement = mobileParty.TargetSettlement;
					mobileParty.Ai.SetMoveModeHold();
					mobileParty.Ai.SetNavigationModeHold();
					mobileParty.Ai.SetMoveGoToSettlement(targetSettlement);
					flag = false;
				}
				if (flag)
				{
					mobileParty.Ai.SetMoveModeHold();
					mobileParty.Ai.SetNavigationModeHold();
				}
			}
			this.OnRemoveParty();
			this._customHomeSettlement = null;
		}

		// Token: 0x17000965 RID: 2405
		// (get) Token: 0x0600257B RID: 9595 RVA: 0x0009E7C4 File Offset: 0x0009C9C4
		public bool IsMoving
		{
			get
			{
				if (this.IsMainParty)
				{
					return !Campaign.Current.IsMainPartyWaiting;
				}
				return this.Position2D != this.TargetPosition || (this.MapEvent == null && this.BesiegedSettlement == null && this.CurrentSettlement == null && this.ShortTermBehavior > AiBehavior.Hold);
			}
		}

		// Token: 0x0600257C RID: 9596 RVA: 0x0009E820 File Offset: 0x0009CA20
		private void ReleaseHeroPrisoners()
		{
			for (int i = this.PrisonRoster.Count - 1; i >= 0; i--)
			{
				if (this.PrisonRoster.GetElementNumber(i) > 0)
				{
					TroopRosterElement elementCopyAtIndex = this.PrisonRoster.GetElementCopyAtIndex(i);
					if (elementCopyAtIndex.Character.IsHero && !elementCopyAtIndex.Character.IsPlayerCharacter)
					{
						EndCaptivityAction.ApplyByReleasedByChoice(elementCopyAtIndex.Character.HeroObject, null);
					}
				}
			}
		}

		// Token: 0x17000966 RID: 2406
		// (get) Token: 0x0600257D RID: 9597 RVA: 0x0009E88C File Offset: 0x0009CA8C
		public bool ShouldBeIgnored
		{
			get
			{
				return this._ignoredUntilTime.IsFuture;
			}
		}

		// Token: 0x0600257E RID: 9598 RVA: 0x0009E89C File Offset: 0x0009CA9C
		private void CreateFigure(Vec2 position, float spawnRadius)
		{
			Vec2 accessiblePointNearPosition = Campaign.Current.MapSceneWrapper.GetAccessiblePointNearPosition(position, spawnRadius);
			this.Position2D = new Vec2(accessiblePointNearPosition.x, accessiblePointNearPosition.y);
			Vec2 bearing = new Vec2(1f, 0f);
			float angleInRadians = MBRandom.RandomFloat * 2f * 3.1415927f;
			bearing.RotateCCW(angleInRadians);
			this.Bearing = bearing;
			this.Party.UpdateVisibilityAndInspected(0f);
			this.StartUp();
		}

		// Token: 0x0600257F RID: 9599 RVA: 0x0009E91A File Offset: 0x0009CB1A
		internal void SendPartyToReachablePointAroundPosition(Vec2 centerPosition, float distanceLimit, float innerCenterMinimumDistanceLimit = 0f)
		{
			this.Ai.SetMoveGoToPoint(MobilePartyHelper.FindReachablePointAroundPosition(centerPosition, distanceLimit, innerCenterMinimumDistanceLimit));
		}

		// Token: 0x06002580 RID: 9600 RVA: 0x0009E930 File Offset: 0x0009CB30
		internal void TeleportPartyToSafePosition(float maxRadius = 3.3f, float minRadius = 3f)
		{
			for (int i = 0; i < 15; i++)
			{
				Vec2 vec = MobilePartyHelper.FindReachablePointAroundPosition(this.Position2D, maxRadius, minRadius);
				bool flag = true;
				LocatableSearchData<MobileParty> locatableSearchData = MobileParty.StartFindingLocatablesAroundPosition(vec, 1f);
				for (MobileParty mobileParty = MobileParty.FindNextLocatable(ref locatableSearchData); mobileParty != null; mobileParty = MobileParty.FindNextLocatable(ref locatableSearchData))
				{
					if (mobileParty.MapFaction.IsAtWarWith(this.MapFaction))
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					this.Position2D = vec;
					return;
				}
			}
		}

		// Token: 0x17000967 RID: 2407
		// (get) Token: 0x06002581 RID: 9601 RVA: 0x0009E9A4 File Offset: 0x0009CBA4
		public float FoodChange
		{
			get
			{
				ExplainedNumber baseConsumption = Campaign.Current.Models.MobilePartyFoodConsumptionModel.CalculateDailyBaseFoodConsumptionf(this, false);
				return Campaign.Current.Models.MobilePartyFoodConsumptionModel.CalculateDailyFoodConsumptionf(this, baseConsumption).ResultNumber;
			}
		}

		// Token: 0x17000968 RID: 2408
		// (get) Token: 0x06002582 RID: 9602 RVA: 0x0009E9E8 File Offset: 0x0009CBE8
		public float BaseFoodChange
		{
			get
			{
				return Campaign.Current.Models.MobilePartyFoodConsumptionModel.CalculateDailyBaseFoodConsumptionf(this, false).ResultNumber;
			}
		}

		// Token: 0x17000969 RID: 2409
		// (get) Token: 0x06002583 RID: 9603 RVA: 0x0009EA14 File Offset: 0x0009CC14
		public ExplainedNumber FoodChangeExplained
		{
			get
			{
				ExplainedNumber baseConsumption = Campaign.Current.Models.MobilePartyFoodConsumptionModel.CalculateDailyBaseFoodConsumptionf(this, true);
				return Campaign.Current.Models.MobilePartyFoodConsumptionModel.CalculateDailyFoodConsumptionf(this, baseConsumption);
			}
		}

		// Token: 0x1700096A RID: 2410
		// (get) Token: 0x06002584 RID: 9604 RVA: 0x0009EA50 File Offset: 0x0009CC50
		public float HealingRateForRegulars
		{
			get
			{
				return Campaign.Current.Models.PartyHealingModel.GetDailyHealingForRegulars(this, false).ResultNumber;
			}
		}

		// Token: 0x1700096B RID: 2411
		// (get) Token: 0x06002585 RID: 9605 RVA: 0x0009EA7B File Offset: 0x0009CC7B
		public ExplainedNumber HealingRateForRegularsExplained
		{
			get
			{
				return Campaign.Current.Models.PartyHealingModel.GetDailyHealingForRegulars(this, true);
			}
		}

		// Token: 0x1700096C RID: 2412
		// (get) Token: 0x06002586 RID: 9606 RVA: 0x0009EA94 File Offset: 0x0009CC94
		public float HealingRateForHeroes
		{
			get
			{
				return Campaign.Current.Models.PartyHealingModel.GetDailyHealingHpForHeroes(this, false).ResultNumber;
			}
		}

		// Token: 0x1700096D RID: 2413
		// (get) Token: 0x06002587 RID: 9607 RVA: 0x0009EABF File Offset: 0x0009CCBF
		public ExplainedNumber HealingRateForHeroesExplained
		{
			get
			{
				return Campaign.Current.Models.PartyHealingModel.GetDailyHealingHpForHeroes(this, true);
			}
		}

		// Token: 0x1700096E RID: 2414
		// (get) Token: 0x06002588 RID: 9608 RVA: 0x0009EAD7 File Offset: 0x0009CCD7
		public ExplainedNumber SeeingRangeExplanation
		{
			get
			{
				return Campaign.Current.Models.MapVisibilityModel.GetPartySpottingRange(this, true);
			}
		}

		// Token: 0x1700096F RID: 2415
		// (get) Token: 0x06002589 RID: 9609 RVA: 0x0009EAF0 File Offset: 0x0009CCF0
		public int InventoryCapacity
		{
			get
			{
				return (int)Campaign.Current.Models.InventoryCapacityModel.CalculateInventoryCapacity(this, false, 0, 0, 0, false).ResultNumber;
			}
		}

		// Token: 0x17000970 RID: 2416
		// (get) Token: 0x0600258A RID: 9610 RVA: 0x0009EB20 File Offset: 0x0009CD20
		public ExplainedNumber InventoryCapacityExplainedNumber
		{
			get
			{
				return Campaign.Current.Models.InventoryCapacityModel.CalculateInventoryCapacity(this, true, 0, 0, 0, false);
			}
		}

		// Token: 0x17000971 RID: 2417
		// (get) Token: 0x0600258B RID: 9611 RVA: 0x0009EB3C File Offset: 0x0009CD3C
		// (set) Token: 0x0600258C RID: 9612 RVA: 0x0009EB49 File Offset: 0x0009CD49
		public MapEventSide MapEventSide
		{
			get
			{
				return this.Party.MapEventSide;
			}
			set
			{
				this.Party.MapEventSide = value;
			}
		}

		// Token: 0x0600258D RID: 9613 RVA: 0x0009EB57 File Offset: 0x0009CD57
		public static LocatableSearchData<MobileParty> StartFindingLocatablesAroundPosition(Vec2 position, float radius)
		{
			return Campaign.Current.MobilePartyLocator.StartFindingLocatablesAroundPosition(position, radius);
		}

		// Token: 0x0600258E RID: 9614 RVA: 0x0009EB6A File Offset: 0x0009CD6A
		public static MobileParty FindNextLocatable(ref LocatableSearchData<MobileParty> data)
		{
			return Campaign.Current.MobilePartyLocator.FindNextLocatable(ref data);
		}

		// Token: 0x0600258F RID: 9615 RVA: 0x0009EB7C File Offset: 0x0009CD7C
		internal void OnHeroAdded(Hero hero)
		{
			hero.OnAddedToParty(this);
		}

		// Token: 0x06002590 RID: 9616 RVA: 0x0009EB85 File Offset: 0x0009CD85
		internal void OnHeroRemoved(Hero hero)
		{
			hero.OnRemovedFromParty(this);
		}

		// Token: 0x06002591 RID: 9617 RVA: 0x0009EB90 File Offset: 0x0009CD90
		internal void CheckExitingSettlementParallel(ref int exitingPartyCount, ref MobileParty[] exitingPartyList)
		{
			if (!this.Ai.IsDisabled && this.ShortTermBehavior != AiBehavior.Hold && this.CurrentSettlement != null && (!this.IsCurrentlyGoingToSettlement || this.ShortTermTargetSettlement != this.CurrentSettlement) && !this.IsMainParty && (this.Army == null || this.AttachedTo == null || this.Army.LeaderParty == this))
			{
				int num = Interlocked.Increment(ref exitingPartyCount);
				exitingPartyList[num] = this;
			}
		}

		// Token: 0x06002592 RID: 9618 RVA: 0x0009EC04 File Offset: 0x0009CE04
		public bool ComputeIsWaiting()
		{
			return (2f * this.Position2D - this.TargetPosition - this.Ai.NextTargetPosition).LengthSquared < 1E-05f || this.DefaultBehavior == AiBehavior.Hold || ((this.DefaultBehavior == AiBehavior.EngageParty || this.DefaultBehavior == AiBehavior.EscortParty) && this.Ai.AiBehaviorPartyBase != null && this.Ai.AiBehaviorPartyBase.IsValid && this.Ai.AiBehaviorPartyBase.IsActive && this.Ai.AiBehaviorPartyBase.IsMobile && this.Ai.AiBehaviorPartyBase.MobileParty.CurrentSettlement != null);
		}

		// Token: 0x17000972 RID: 2418
		// (get) Token: 0x06002593 RID: 9619 RVA: 0x0009ECC5 File Offset: 0x0009CEC5
		bool IMapEntity.ShowCircleAroundEntity
		{
			get
			{
				return this.CurrentSettlement == null;
			}
		}

		// Token: 0x06002594 RID: 9620 RVA: 0x0009ECD0 File Offset: 0x0009CED0
		void IMapEntity.OnOpenEncyclopedia()
		{
			if (this.IsLordParty && this.LeaderHero != null)
			{
				Campaign.Current.EncyclopediaManager.GoToLink(this.LeaderHero.EncyclopediaLink);
			}
		}

		// Token: 0x06002595 RID: 9621 RVA: 0x0009ECFC File Offset: 0x0009CEFC
		bool IMapEntity.OnMapClick(bool followModifierUsed)
		{
			if (this.IsMainParty)
			{
				MobileParty.MainParty.Ai.SetMoveModeHold();
			}
			else if (followModifierUsed)
			{
				MobileParty.MainParty.Ai.SetMoveEscortParty(this);
			}
			else
			{
				MobileParty.MainParty.Ai.SetMoveEngageParty(this);
			}
			return true;
		}

		// Token: 0x06002596 RID: 9622 RVA: 0x0009ED48 File Offset: 0x0009CF48
		void IMapEntity.OnHover()
		{
			Army army = this.Army;
			if (((army != null) ? army.LeaderParty : null) == this)
			{
				InformationManager.ShowTooltip(typeof(Army), new object[]
				{
					this.Army,
					false,
					true
				});
				return;
			}
			InformationManager.ShowTooltip(typeof(MobileParty), new object[]
			{
				this,
				false,
				true
			});
		}

		// Token: 0x06002597 RID: 9623 RVA: 0x0009EDC6 File Offset: 0x0009CFC6
		bool IMapEntity.IsEnemyOf(IFaction faction)
		{
			return FactionManager.IsAtWarAgainstFaction(this.MapFaction, faction);
		}

		// Token: 0x06002598 RID: 9624 RVA: 0x0009EDD4 File Offset: 0x0009CFD4
		bool IMapEntity.IsAllyOf(IFaction faction)
		{
			return FactionManager.IsAlliedWithFaction(this.MapFaction, faction);
		}

		// Token: 0x06002599 RID: 9625 RVA: 0x0009EDE2 File Offset: 0x0009CFE2
		public void GetMountAndHarnessVisualIdsForPartyIcon(out string mountStringId, out string harnessStringId)
		{
			mountStringId = "";
			harnessStringId = "";
			PartyComponent partyComponent = this._partyComponent;
			if (partyComponent == null)
			{
				return;
			}
			partyComponent.GetMountAndHarnessVisualIdsForPartyIcon(this.Party, out mountStringId, out harnessStringId);
		}

		// Token: 0x17000973 RID: 2419
		// (get) Token: 0x0600259A RID: 9626 RVA: 0x0009EE0A File Offset: 0x0009D00A
		Vec2 IMapEntity.InteractionPosition
		{
			get
			{
				return this.Position2D;
			}
		}

		// Token: 0x17000974 RID: 2420
		// (get) Token: 0x0600259B RID: 9627 RVA: 0x0009EE12 File Offset: 0x0009D012
		bool IMapEntity.IsMobileEntity
		{
			get
			{
				return true;
			}
		}

		// Token: 0x0600259C RID: 9628 RVA: 0x0009EE18 File Offset: 0x0009D018
		void IMapEntity.OnPartyInteraction(MobileParty engagingParty)
		{
			MobileParty mobileParty = this;
			if (mobileParty.AttachedTo != null && engagingParty != mobileParty.AttachedTo)
			{
				mobileParty = mobileParty.AttachedTo;
			}
			bool flag = false;
			if (mobileParty.CurrentSettlement != null)
			{
				if (mobileParty.MapEvent != null)
				{
					flag = (mobileParty.MapEvent.MapEventSettlement == mobileParty.CurrentSettlement && (mobileParty.MapEvent.AttackerSide.LeaderParty.MapFaction == engagingParty.MapFaction || mobileParty.MapEvent.DefenderSide.LeaderParty.MapFaction == engagingParty.MapFaction));
				}
			}
			else
			{
				flag = (engagingParty != MobileParty.MainParty || !mobileParty.IsEngaging || mobileParty.ShortTermTargetParty != MobileParty.MainParty);
			}
			if (flag)
			{
				if (engagingParty == MobileParty.MainParty)
				{
					MapState mapState = Game.Current.GameStateManager.ActiveState as MapState;
					if (mapState != null)
					{
						mapState.OnMainPartyEncounter();
					}
				}
				EncounterManager.StartPartyEncounter(engagingParty.Party, mobileParty.Party);
			}
		}

		// Token: 0x0600259D RID: 9629 RVA: 0x0009EF08 File Offset: 0x0009D108
		public void InitializePartyTrade(int initialGold)
		{
			this.IsPartyTradeActive = true;
			this.PartyTradeGold = initialGold;
		}

		// Token: 0x0600259E RID: 9630 RVA: 0x0009EF18 File Offset: 0x0009D118
		public void AddTaxGold(int amount)
		{
			this.PartyTradeTaxGold += amount;
		}

		// Token: 0x0600259F RID: 9631 RVA: 0x0009EF28 File Offset: 0x0009D128
		public static MobileParty CreateParty(string stringId, PartyComponent component, PartyComponent.OnPartyComponentCreatedDelegate delegateFunction = null)
		{
			stringId = Campaign.Current.CampaignObjectManager.FindNextUniqueStringId<MobileParty>(stringId);
			MobileParty mobileParty = new MobileParty();
			mobileParty.StringId = stringId;
			mobileParty._partyComponent = component;
			mobileParty.UpdatePartyComponentFlags();
			if (component != null)
			{
				component.SetMobilePartyInternal(mobileParty);
			}
			if (delegateFunction != null)
			{
				delegateFunction(mobileParty);
			}
			PartyComponent partyComponent = mobileParty.PartyComponent;
			if (partyComponent != null)
			{
				partyComponent.Initialize(mobileParty);
			}
			Campaign.Current.CampaignObjectManager.AddMobileParty(mobileParty);
			CampaignEventDispatcher.Instance.OnMobilePartyCreated(mobileParty);
			return mobileParty;
		}

		// Token: 0x17000975 RID: 2421
		// (get) Token: 0x060025A0 RID: 9632 RVA: 0x0009EFA3 File Offset: 0x0009D1A3
		public CaravanPartyComponent CaravanPartyComponent
		{
			get
			{
				return this._partyComponent as CaravanPartyComponent;
			}
		}

		// Token: 0x17000976 RID: 2422
		// (get) Token: 0x060025A1 RID: 9633 RVA: 0x0009EFB0 File Offset: 0x0009D1B0
		public WarPartyComponent WarPartyComponent
		{
			get
			{
				return this._partyComponent as WarPartyComponent;
			}
		}

		// Token: 0x17000977 RID: 2423
		// (get) Token: 0x060025A2 RID: 9634 RVA: 0x0009EFBD File Offset: 0x0009D1BD
		public BanditPartyComponent BanditPartyComponent
		{
			get
			{
				return this._partyComponent as BanditPartyComponent;
			}
		}

		// Token: 0x17000978 RID: 2424
		// (get) Token: 0x060025A3 RID: 9635 RVA: 0x0009EFCA File Offset: 0x0009D1CA
		public LordPartyComponent LordPartyComponent
		{
			get
			{
				return this._partyComponent as LordPartyComponent;
			}
		}

		// Token: 0x17000979 RID: 2425
		// (get) Token: 0x060025A4 RID: 9636 RVA: 0x0009EFD7 File Offset: 0x0009D1D7
		// (set) Token: 0x060025A5 RID: 9637 RVA: 0x0009EFE0 File Offset: 0x0009D1E0
		public PartyComponent PartyComponent
		{
			get
			{
				return this._partyComponent;
			}
			set
			{
				if (this._partyComponent != value)
				{
					if (this._partyComponent != null)
					{
						this._partyComponent.Finish();
					}
					Campaign.Current.CampaignObjectManager.BeforePartyComponentChanged(this);
					this._partyComponent = value;
					this.UpdatePartyComponentFlags();
					Campaign.Current.CampaignObjectManager.AfterPartyComponentChanged(this);
					if (this._partyComponent != null)
					{
						this._partyComponent.Initialize(this);
					}
				}
			}
		}

		// Token: 0x1700097A RID: 2426
		// (get) Token: 0x060025A6 RID: 9638 RVA: 0x0009F04A File Offset: 0x0009D24A
		// (set) Token: 0x060025A7 RID: 9639 RVA: 0x0009F052 File Offset: 0x0009D252
		[CachedData]
		public bool IsMilitia { get; private set; }

		// Token: 0x1700097B RID: 2427
		// (get) Token: 0x060025A8 RID: 9640 RVA: 0x0009F05B File Offset: 0x0009D25B
		// (set) Token: 0x060025A9 RID: 9641 RVA: 0x0009F063 File Offset: 0x0009D263
		[CachedData]
		public bool IsLordParty { get; private set; }

		// Token: 0x060025AA RID: 9642 RVA: 0x0009F06C File Offset: 0x0009D26C
		public void UpdatePartyComponentFlags()
		{
			this.IsLordParty = (this._partyComponent is LordPartyComponent);
			this.IsVillager = (this._partyComponent is VillagerPartyComponent);
			this.IsMilitia = (this._partyComponent is MilitiaPartyComponent);
			this.IsCaravan = (this._partyComponent is CaravanPartyComponent);
			this.IsGarrison = (this._partyComponent is GarrisonPartyComponent);
			this.IsCustomParty = (this._partyComponent is CustomPartyComponent);
			this.IsBandit = (this._partyComponent is BanditPartyComponent);
		}

		// Token: 0x1700097C RID: 2428
		// (get) Token: 0x060025AB RID: 9643 RVA: 0x0009F105 File Offset: 0x0009D305
		// (set) Token: 0x060025AC RID: 9644 RVA: 0x0009F10D File Offset: 0x0009D30D
		[CachedData]
		public bool IsVillager { get; private set; }

		// Token: 0x1700097D RID: 2429
		// (get) Token: 0x060025AD RID: 9645 RVA: 0x0009F116 File Offset: 0x0009D316
		// (set) Token: 0x060025AE RID: 9646 RVA: 0x0009F11E File Offset: 0x0009D31E
		[CachedData]
		public bool IsCaravan { get; private set; }

		// Token: 0x1700097E RID: 2430
		// (get) Token: 0x060025AF RID: 9647 RVA: 0x0009F127 File Offset: 0x0009D327
		// (set) Token: 0x060025B0 RID: 9648 RVA: 0x0009F12F File Offset: 0x0009D32F
		[CachedData]
		public bool IsGarrison { get; private set; }

		// Token: 0x1700097F RID: 2431
		// (get) Token: 0x060025B1 RID: 9649 RVA: 0x0009F138 File Offset: 0x0009D338
		// (set) Token: 0x060025B2 RID: 9650 RVA: 0x0009F140 File Offset: 0x0009D340
		[CachedData]
		public bool IsCustomParty { get; private set; }

		// Token: 0x17000980 RID: 2432
		// (get) Token: 0x060025B3 RID: 9651 RVA: 0x0009F149 File Offset: 0x0009D349
		// (set) Token: 0x060025B4 RID: 9652 RVA: 0x0009F151 File Offset: 0x0009D351
		[CachedData]
		public bool IsBandit { get; private set; }

		// Token: 0x17000981 RID: 2433
		// (get) Token: 0x060025B5 RID: 9653 RVA: 0x0009F15A File Offset: 0x0009D35A
		public bool IsBanditBossParty
		{
			get
			{
				return this.IsBandit && this.BanditPartyComponent.IsBossParty;
			}
		}

		// Token: 0x17000982 RID: 2434
		// (get) Token: 0x060025B6 RID: 9654 RVA: 0x0009F171 File Offset: 0x0009D371
		public bool AvoidHostileActions
		{
			get
			{
				return this._partyComponent != null && this._partyComponent.AvoidHostileActions;
			}
		}

		// Token: 0x04000B0D RID: 2829
		public const int DefaultPartyTradeInitialGold = 5000;

		// Token: 0x04000B0E RID: 2830
		public const int ClanRoleAssignmentMinimumSkillValue = 0;

		// Token: 0x04000B10 RID: 2832
		[SaveableField(1001)]
		private Settlement _currentSettlement;

		// Token: 0x04000B13 RID: 2835
		[CachedData]
		private MBList<MobileParty> _attachedParties;

		// Token: 0x04000B14 RID: 2836
		[SaveableField(1046)]
		private MobileParty _attachedTo;

		// Token: 0x04000B16 RID: 2838
		[SaveableField(1006)]
		public float HasUnpaidWages;

		// Token: 0x04000B18 RID: 2840
		[SaveableField(1060)]
		private Vec2 _eventPositionAdder;

		// Token: 0x04000B1A RID: 2842
		[SaveableField(1100)]
		private Vec2 _position2D;

		// Token: 0x04000B1F RID: 2847
		[SaveableField(1024)]
		private bool _isVisible;

		// Token: 0x04000B20 RID: 2848
		[CachedData]
		internal float _lastCalculatedSpeed = 1f;

		// Token: 0x04000B21 RID: 2849
		[SaveableField(1025)]
		private bool _isInspected;

		// Token: 0x04000B22 RID: 2850
		[SaveableField(1955)]
		private CampaignTime _disorganizedUntilTime;

		// Token: 0x04000B23 RID: 2851
		[CachedData]
		private int _partyPureSpeedLastCheckVersion = -1;

		// Token: 0x04000B24 RID: 2852
		[CachedData]
		private bool _partyLastCheckIsPrisoner;

		// Token: 0x04000B25 RID: 2853
		[CachedData]
		private ExplainedNumber _lastCalculatedBaseSpeedExplained;

		// Token: 0x04000B27 RID: 2855
		[CachedData]
		private bool _partyLastCheckAtNight;

		// Token: 0x04000B28 RID: 2856
		[CachedData]
		private int _itemRosterVersionNo = -1;

		// Token: 0x04000B29 RID: 2857
		[CachedData]
		private int _partySizeRatioLastCheckVersion = -1;

		// Token: 0x04000B2A RID: 2858
		[CachedData]
		private int _latestUsedPaymentRatio = -1;

		// Token: 0x04000B2B RID: 2859
		[CachedData]
		private float _cachedPartySizeRatio = 1f;

		// Token: 0x04000B2C RID: 2860
		[CachedData]
		private int _cachedPartySizeLimit;

		// Token: 0x04000B2D RID: 2861
		[SaveableField(1059)]
		private BesiegerCamp _besiegerCamp;

		// Token: 0x04000B2E RID: 2862
		[SaveableField(1048)]
		private MobileParty _targetParty;

		// Token: 0x04000B2F RID: 2863
		[SaveableField(1049)]
		private Settlement _targetSettlement;

		// Token: 0x04000B30 RID: 2864
		[SaveableField(1053)]
		private Vec2 _targetPosition;

		// Token: 0x04000B31 RID: 2865
		private int _doNotAttackMainParty;

		// Token: 0x04000B32 RID: 2866
		[SaveableField(1034)]
		private Settlement _customHomeSettlement;

		// Token: 0x04000B33 RID: 2867
		[SaveableField(1035)]
		private Army _army;

		// Token: 0x04000B34 RID: 2868
		[CachedData]
		private bool _isDisorganized;

		// Token: 0x04000B35 RID: 2869
		[SaveableField(1959)]
		private bool _isCurrentlyUsedByAQuest;

		// Token: 0x04000B38 RID: 2872
		[SaveableField(1956)]
		private int _partyTradeGold;

		// Token: 0x04000B3A RID: 2874
		[SaveableField(1063)]
		private CampaignTime _ignoredUntilTime;

		// Token: 0x04000B3C RID: 2876
		[SaveableField(1071)]
		public Vec2 AverageFleeTargetDirection;

		// Token: 0x04000B3E RID: 2878
		private bool _besiegerCampResetStarted;

		// Token: 0x04000B41 RID: 2881
		[CachedData]
		private int _locatorNodeIndex;

		// Token: 0x04000B46 RID: 2886
		[SaveableField(1120)]
		private Clan _actualClan;

		// Token: 0x04000B47 RID: 2887
		[SaveableField(1200)]
		private float _moraleDueToEvents;

		// Token: 0x04000B48 RID: 2888
		[CachedData]
		private PathFaceRecord _lastNavigationFace;

		// Token: 0x04000B49 RID: 2889
		[CachedData]
		private MapWeatherModel.WeatherEventEffectOnTerrain _lastWeatherTerrainEffect;

		// Token: 0x04000B4A RID: 2890
		[CachedData]
		private PathFaceRecord _currentNavigationFace;

		// Token: 0x04000B4C RID: 2892
		[SaveableField(210)]
		private PartyComponent _partyComponent;

		// Token: 0x020005B1 RID: 1457
		public enum PartyObjective
		{
			// Token: 0x040017AF RID: 6063
			Neutral,
			// Token: 0x040017B0 RID: 6064
			Defensive,
			// Token: 0x040017B1 RID: 6065
			Aggressive,
			// Token: 0x040017B2 RID: 6066
			NumberOfPartyObjectives
		}

		// Token: 0x020005B2 RID: 1458
		internal struct CachedPartyVariables
		{
			// Token: 0x040017B3 RID: 6067
			internal bool IsAttachedArmyMember;

			// Token: 0x040017B4 RID: 6068
			internal bool IsArmyLeader;

			// Token: 0x040017B5 RID: 6069
			internal bool IsMoving;

			// Token: 0x040017B6 RID: 6070
			internal bool HasMapEvent;

			// Token: 0x040017B7 RID: 6071
			internal float NextMoveDistance;

			// Token: 0x040017B8 RID: 6072
			internal Vec2 CurrentPosition;

			// Token: 0x040017B9 RID: 6073
			internal Vec2 LastCurrentPosition;

			// Token: 0x040017BA RID: 6074
			internal Vec2 NextPosition;

			// Token: 0x040017BB RID: 6075
			internal Vec2 TargetPartyPositionAtFrameStart;

			// Token: 0x040017BC RID: 6076
			internal PathFaceRecord TargetPartyCurrentNavigationFaceAtFrameStart;

			// Token: 0x040017BD RID: 6077
			internal PathFaceRecord NextPathFaceRecord;
		}
	}
}
